12345678910111213141516171819202122 |
- state.persist('pyscript.ext_light_on_done','off')
- state.persist('pyscript.ext_light_off_done','off')
- @time_trigger("once(00:15:00)")
- def reset_ext_light_done_states():
- log.info(f"Reset the ext light done state variables.")
- pyscript.ext_light_on_done = 'off'
- pyscript.ext_light_off_done = 'off'
- @state_trigger( "int(sensor.lux_outside_the_garage) < 100 and int(sensor.lux_outside_the_garage.old) >= 100")
- def automate_exterior_lights_on_in_evening():
- if pyscript.ext_light_on_done == 'off' and input_boolean.exterior_lights_wanted_state == 'off':
- input_boolean.exterior_lights_wanted_state = 'on'
- pyscript.ext_light_on_done = 'on'
- @state_trigger( "int(sensor.lux_outside_the_garage) > 50 and int(sensor.lux_outside_the_garage.old) <= 50")
- def automate_exterior_lights_off_in_morning():
- if pyscript.ext_light_off_done == 'off' and input_boolean.exterior_lights_wanted_state == 'on':
- input_boolean.exterior_lights_wanted_state = 'off'
- pyscript.ext_light_off_done = 'on'
|