Thanks for reduced template!
But i still get this sensor as unavailable - i checked all indents and structure - found that i had some template in configuration.yaml and some in templates.yaml.
Now i can’t combine correctly both of them in templates.yaml.
- sensor:
- name: "Мосэнергосбыт"
unique_id: 220_price
unit_of_measurement: "RUB"
state: >
{% set t = (now().hour, now().minute) %}
{{ iif(t >= (23,0) or t <= (7,0), 2.09, 5.5) }}
- trigger:
- platform: state
entity_id: binary_sensor.nasos
to: 'on'
- platform: time_pattern
hours: '/1'
sensor:
- name: Water Pump Hourly Counter
unique_id: 6759e0f7-e104-4690-a700-3fce4d92bddc
state_class: total_increasing
state: "{{ 0 if trigger.platform == 'time_pattern' else this.state | int(0) + 1 }}"
This gives me error “Error loading /config/configuration.yaml: while parsing a block mapping in “/config/templates.yaml”, line 9, column 3 expected , but found ‘’ in “/config/templates.yaml”, line 15, column 5”.
How it can be fixed ?
Upd. Moved price template from yaml to GUI, and trigger template back to configuration.yaml.