homeassistant-config/pyscript/herd.py

15 lines
508 B
Python
Raw Permalink Normal View History

2021-10-05 13:22:27 +02:00
@state_trigger("switch.esszimmer_szene_4")
def esszimmer_gangtuer_herd(value=None):
entity_id = [f"switch.herd_phase_{i}" for i in range(1, 4)]
if value == "on":
switch.turn_on(entity_id=entity_id)
elif value == "off":
switch.turn_off(entity_id=entity_id)
@state_trigger("float(sensor.herd_phase_1_verbrauch) + float(sensor.herd_phase_2_verbrauch) + float(sensor.herd_phase_3_verbrauch) < 100", state_hold=30 * 60)
def herd_auto_aus():
switch.esszimmer_szene_4.turn_off()