# This state is set every midnight by the ext_lights_control-script state.persist('pyscript.home_auto_lights_off_has_been_night','false') @state_trigger("int(sensor.lux_outside_the_garage) > 1000", state_hold_false=0) def automate_home_auto_lights_off(): if( pyscript.home_auto_lights_off_has_been_night == 'true' ): pyscript.home_auto_lights_off_has_been_night = 'false' pyscript.state_goto_all_off(); # Activate morning lights when Thomas gets up @time_trigger("once(06:18:00)") def morning_lights_thomas(): if binary_sensor.workday_sensor == 'on': if switch.eng_heat_a == 'on' or switch.eng_heat_b == 'on': pyscript.state_goto_morning();