Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################
- ## Inputs
- ################################################
- input_boolean:
- klima_hodnik_status:
- name: klima_hodnik_status
- initial: off
- icon: mdi:dishwasher
- input_number:
- klima_hodnik_start:
- name: klima_hodnik_start
- min: 0
- max: 999999999
- klima_hodnik_stop:
- name: klima_hodnik_stop
- min: 0
- max: 999999999
- #klima hodnik spodaj
- - platform: template
- sensors:
- klima_hodnik_watts:
- friendly_name: "Klima Hodnik - trenutna poraba"
- value_template: '{{ states.switch.klima_hodnik.attributes["current_power_w"] | replace(" W", "") | float }}'
- unit_of_measurement: 'W'
- klima_hodnik_today_kwh:
- friendly_name: "Klima Hodnik - danasnja poraba"
- value_template: '{{ states.switch.klima_hodnik.attributes["today_energy_kwh"] | replace(" kW", "") | float }}'
- unit_of_measurement: 'kWh'
- klima_hodnik_amps:
- friendly_name: "Klima Hodnik - tok"
- value_template: '{{ states.switch.klima_hodnik.attributes["current_a"] | replace(" A", "") | float }}'
- unit_of_measurement: 'A'
- klima_hodnik_total_kwh:
- friendly_name: "Klima Hodnik - skupna poraba"
- value_template: '{{ states.switch.klima_hodnik.attributes["total_energy_kwh"] | replace(" kW", "") | float }}'
- unit_of_measurement: 'kWh'
- klima_hodnik_volts:
- friendly_name: "Klima Hodnik - napetost"
- value_template: '{{ states.switch.klima_hodnik.attributes["voltage"] | replace(" V", "") | float }}'
- unit_of_measurement: 'V'
- - platform: statistics
- entity_id: sensor.klima_hodnik_watts
- name: klima_hodnik_statistics
- sampling_size: 5
- max_age:
- minutes: 1
- - platform: template
- sensors:
- klima_hodnik_consumption:
- friendly_name: "Klima hodnik - poraba tokrat"
- value_template: '{{ (float(states("input_number.klima_hodnik_stop")) - float(states("input_number.klima_hodnik_start"))) | round(3) }}'
- unit_of_measurement: 'kWh'
- - platform: template
- sensors:
- klima_hodnik_status_time:
- friendly_name: "Klima hodnik cas delovanja"
- unit_of_measurement: 'minute'
- value_template: >
- {% if is_state("input_boolean.klima_hodnik", "on") -%}
- {{ ((as_timestamp(now())-as_timestamp(states.input_boolean.klima_hodnik.last_changed))/60) | round | int }}
- {% else %}
- 0
- {% endif %}
- entity_id: sensor.time
- klima_hodnik_status_value:
- friendly_name: "Klima hodnik status"
- value_template: >-
- {%- if is_state('input_boolean.klima_hodnik', 'on') -%} On
- {%- else -%} Off
- {%- endif -%}
- # HISTORY klima_hodnik
- - platform: history_stats
- name: klima_hodnik this week
- entity_id: input_boolean.klima_hodnik
- state: 'on'
- type: time
- start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
- end: '{{ now() }}'
- - platform: history_stats
- name: klima_hodnik this month
- entity_id: input_boolean.klima_hodnik
- state: 'on'
- type: time
- end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
- duration:
- days: 30
- - platform: template
- sensors:
- percent_klima_hodnik_weekly:
- unit_of_measurement: "%"
- value_template: "{{ '%.1f'|format(states('sensor.klima_hodnik_this_week')|float * 100 / 168) }}"
- - platform: template
- sensors:
- percent_klima_hodnik_monthly:
- unit_of_measurement: "%"
- value_template: "{{ '%.1f'|format(states('sensor.klima_hodnik_this_month')|float * 100 / 720) }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement