Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. ################################################
  2. ## Inputs
  3. ################################################
  4. input_boolean:
  5. klima_hodnik_status:
  6. name: klima_hodnik_status
  7. initial: off
  8. icon: mdi:dishwasher
  9.  
  10. input_number:
  11. klima_hodnik_start:
  12. name: klima_hodnik_start
  13. min: 0
  14. max: 999999999
  15. klima_hodnik_stop:
  16. name: klima_hodnik_stop
  17. min: 0
  18. max: 999999999
  19.  
  20. #klima hodnik spodaj
  21. - platform: template
  22. sensors:
  23. klima_hodnik_watts:
  24. friendly_name: "Klima Hodnik - trenutna poraba"
  25. value_template: '{{ states.switch.klima_hodnik.attributes["current_power_w"] | replace(" W", "") | float }}'
  26. unit_of_measurement: 'W'
  27. klima_hodnik_today_kwh:
  28. friendly_name: "Klima Hodnik - danasnja poraba"
  29. value_template: '{{ states.switch.klima_hodnik.attributes["today_energy_kwh"] | replace(" kW", "") | float }}'
  30. unit_of_measurement: 'kWh'
  31. klima_hodnik_amps:
  32. friendly_name: "Klima Hodnik - tok"
  33. value_template: '{{ states.switch.klima_hodnik.attributes["current_a"] | replace(" A", "") | float }}'
  34. unit_of_measurement: 'A'
  35. klima_hodnik_total_kwh:
  36. friendly_name: "Klima Hodnik - skupna poraba"
  37. value_template: '{{ states.switch.klima_hodnik.attributes["total_energy_kwh"] | replace(" kW", "") | float }}'
  38. unit_of_measurement: 'kWh'
  39. klima_hodnik_volts:
  40. friendly_name: "Klima Hodnik - napetost"
  41. value_template: '{{ states.switch.klima_hodnik.attributes["voltage"] | replace(" V", "") | float }}'
  42. unit_of_measurement: 'V'
  43.  
  44. - platform: statistics
  45. entity_id: sensor.klima_hodnik_watts
  46. name: klima_hodnik_statistics
  47. sampling_size: 5
  48. max_age:
  49. minutes: 1
  50.  
  51. - platform: template
  52. sensors:
  53. klima_hodnik_consumption:
  54. friendly_name: "Klima hodnik - poraba tokrat"
  55. value_template: '{{ (float(states("input_number.klima_hodnik_stop")) - float(states("input_number.klima_hodnik_start"))) | round(3) }}'
  56. unit_of_measurement: 'kWh'
  57.  
  58. - platform: template
  59. sensors:
  60. klima_hodnik_status_time:
  61. friendly_name: "Klima hodnik cas delovanja"
  62. unit_of_measurement: 'minute'
  63. value_template: >
  64. {% if is_state("input_boolean.klima_hodnik", "on") -%}
  65. {{ ((as_timestamp(now())-as_timestamp(states.input_boolean.klima_hodnik.last_changed))/60) | round | int }}
  66. {% else %}
  67. 0
  68. {% endif %}
  69. entity_id: sensor.time
  70. klima_hodnik_status_value:
  71. friendly_name: "Klima hodnik status"
  72. value_template: >-
  73. {%- if is_state('input_boolean.klima_hodnik', 'on') -%} On
  74. {%- else -%} Off
  75. {%- endif -%}
  76.  
  77. # HISTORY klima_hodnik
  78. - platform: history_stats
  79. name: klima_hodnik this week
  80. entity_id: input_boolean.klima_hodnik
  81. state: 'on'
  82. type: time
  83. start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
  84. end: '{{ now() }}'
  85.  
  86. - platform: history_stats
  87. name: klima_hodnik this month
  88. entity_id: input_boolean.klima_hodnik
  89. state: 'on'
  90. type: time
  91. end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  92. duration:
  93. days: 30
  94.  
  95. - platform: template
  96. sensors:
  97. percent_klima_hodnik_weekly:
  98. unit_of_measurement: "%"
  99. value_template: "{{ '%.1f'|format(states('sensor.klima_hodnik_this_week')|float * 100 / 168) }}"
  100.  
  101. - platform: template
  102. sensors:
  103. percent_klima_hodnik_monthly:
  104. unit_of_measurement: "%"
  105.  
  106. value_template: "{{ '%.1f'|format(states('sensor.klima_hodnik_this_month')|float * 100 / 720) }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement