|
@@ -5,23 +5,25 @@ state.persist('pyscript.ext_light_has_been_night','false')
|
|
# Set that it has been midnight, and that it's ok to turn the light on
|
|
# Set that it has been midnight, and that it's ok to turn the light on
|
|
@time_trigger("once(00:30:00)")
|
|
@time_trigger("once(00:30:00)")
|
|
def ext_light_has_been_night():
|
|
def ext_light_has_been_night():
|
|
- pyscript.ext_light_has_been_night = 'true'
|
|
|
|
|
|
+ pyscript.ext_light_has_been_night = 'true'
|
|
|
|
|
|
# Set that it has been noon, and that it's ok to turn off the light
|
|
# Set that it has been noon, and that it's ok to turn off the light
|
|
@time_trigger("once(12:30:00)")
|
|
@time_trigger("once(12:30:00)")
|
|
def ext_light_has_been_day():
|
|
def ext_light_has_been_day():
|
|
- pyscript.ext_light_has_been_day = 'true'
|
|
|
|
|
|
+ pyscript.ext_light_has_been_day = 'true'
|
|
|
|
|
|
|
|
|
|
-@state_trigger("pyscript.ext_light_has_been_day == 'true' and int(sensor.lux_outside_the_garage) < 100")
|
|
|
|
|
|
+@state_trigger("int(sensor.lux_outside_the_garage) < 100", state_hold_false=0 )
|
|
def automate_exterior_lights_on_in_evening():
|
|
def automate_exterior_lights_on_in_evening():
|
|
- pyscript.ext_light_has_been_day = 'false'
|
|
|
|
- input_boolean.exterior_lights_wanted_state = 'on'
|
|
|
|
|
|
+ if( pyscript.ext_light_has_been_day == 'true' ):
|
|
|
|
+ pyscript.ext_light_has_been_day = 'false'
|
|
|
|
+ input_boolean.exterior_lights_wanted_state = 'on'
|
|
|
|
|
|
-@state_trigger("pyscript.ext_light_has_been_night == 'true' and int(sensor.lux_outside_the_garage) > 50")
|
|
|
|
|
|
+@state_trigger("int(sensor.lux_outside_the_garage) > 50", state_hold_false=0)
|
|
def automate_exterior_lights_off_in_morning():
|
|
def automate_exterior_lights_off_in_morning():
|
|
- pyscript.ext_light_has_been_night = 'false'
|
|
|
|
- input_boolean.exterior_lights_wanted_state = 'off'
|
|
|
|
|
|
+ if( pyscript.ext_light_has_been_night == 'true' ):
|
|
|
|
+ pyscript.ext_light_has_been_night = 'false'
|
|
|
|
+ input_boolean.exterior_lights_wanted_state = 'off'
|
|
|
|
|
|
|
|
|
|
|
|
|