I cannot combine binary TOD sensors and other binary sensors in one packade . Generates an error . If I move binary TOD sensors to another package, everything works . How to connect in one package different binary sensors ?
grid_city:
template:
- binary_sensor:
- name: spm90_voltages
unique_id: spm90_voltages
delay_off:
minutes: 3
state: >
{{ states('sensor.spm90_voltage')|float(default=0) < 380 }}
- name: grid_city_on
unique_id: grid_city_on
state: >
{% set voltage = is_state('binary_sensor.spm90_voltages', 'on') %}
{% set high_tariff = is_state('binary_sensor.high_tariff_morning', 'on') or
is_state('binary_sensor.high_tariff_evening', 'on') %}
{{ voltage and high_tariff }}
# ΠΠ΅ΡΠ΅Π²ΠΈΠΉ ΡΠ°ΡΡΡ ΡΠ°Π½ΠΎΠΊ
- platform: tod
name: high_tariff_morning
unique_id: high_tariff_morning
after: "08:00"
before: "11:00"
# ΠΠ΅ΡΠ΅Π²ΠΈΠΉ ΡΠ°ΡΡΡ Π²Π΅ΡΡΡ
- platform: tod
name: high_tariff_evening
unique_id: high_tariff_evening
after: "20:00"
before: "22:00"
automation:
- id: auto_turn_grid_low_battery
alias: auto_turn_grid_low_battery
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.grid_city_on
to: 'on'
- platform: state
entity_id: binary_sensor.grid_city_on
to: 'off'
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.grid_city_on
state: 'on'
sequence:
- service: switch.turn_on
data:
entity_id: switch.0xa4c1386199f45931
- conditions:
- condition: state
entity_id: binary_sensor.grid_city_on
state: 'off'
sequence:
- service: switch.turn_off
data:
entity_id: switch.0xa4c1386199f45931