|
@@ -1,41 +1,42 @@
|
|
|
|
|
|
-state.persist('pyscript.ext_light_has_been_day','false')
|
|
|
-state.persist('pyscript.ext_light_has_been_night','false')
|
|
|
+#state.persist('pyscript.ext_light_has_been_day','false')
|
|
|
+#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
|
|
|
-@time_trigger("once(00:30:00)")
|
|
|
-def ext_light_has_been_night():
|
|
|
- pyscript.ext_light_has_been_night = 'true'
|
|
|
- pyscript.home_auto_lights_off_has_been_night = 'true'
|
|
|
+#@time_trigger("once(00:30:00)")
|
|
|
+#def ext_light_has_been_night():
|
|
|
+# pyscript.ext_light_has_been_night = 'true'
|
|
|
+# pyscript.home_auto_lights_off_has_been_night = 'true'
|
|
|
|
|
|
# Set that it has been noon, and that it's ok to turn off the light
|
|
|
-@time_trigger("once(12:30:00)")
|
|
|
-def ext_light_has_been_day():
|
|
|
- pyscript.ext_light_has_been_day = 'true'
|
|
|
+#@time_trigger("once(12:30:00)")
|
|
|
+#def ext_light_has_been_day():
|
|
|
+# pyscript.ext_light_has_been_day = 'true'
|
|
|
|
|
|
|
|
|
-@state_trigger("sensor.lux_outside_the_garage != 'unknown' and int(sensor.lux_outside_the_garage) < 100", state_hold_false=0 )
|
|
|
-def automate_exterior_lights_on_in_evening():
|
|
|
- if( pyscript.ext_light_has_been_day == 'true' ):
|
|
|
- pyscript.ext_light_has_been_day = 'false'
|
|
|
- input_boolean.exterior_lights_wanted_state = 'on'
|
|
|
+#@state_trigger("sensor.lux_outside_the_garage != 'unknown' and int(sensor.lux_outside_the_garage) < 100", state_hold_false=0 )
|
|
|
+#def automate_exterior_lights_on_in_evening():
|
|
|
+# if( pyscript.ext_light_has_been_day == 'true' ):
|
|
|
+# pyscript.ext_light_has_been_day = 'false'
|
|
|
+# input_boolean.exterior_lights_wanted_state = 'on'
|
|
|
|
|
|
-@state_trigger("sensor.lux_outside_the_garage != 'unknown' and int(sensor.lux_outside_the_garage) > 50", state_hold_false=0)
|
|
|
-def automate_exterior_lights_off_in_morning():
|
|
|
- if( pyscript.ext_light_has_been_night == 'true' ):
|
|
|
- pyscript.ext_light_has_been_night = 'false'
|
|
|
- input_boolean.exterior_lights_wanted_state = 'off'
|
|
|
+#@state_trigger("sensor.lux_outside_the_garage != 'unknown' and int(sensor.lux_outside_the_garage) > 50", state_hold_false=0)
|
|
|
+#def automate_exterior_lights_off_in_morning():
|
|
|
+# if( pyscript.ext_light_has_been_night == 'true' ):
|
|
|
+# pyscript.ext_light_has_been_night = 'false'
|
|
|
+# input_boolean.exterior_lights_wanted_state = 'off'
|
|
|
|
|
|
|
|
|
|
|
|
-@state_trigger("input_boolean.exterior_lights_wanted_state")
|
|
|
-@task_unique("control_ext_light", kill_me=True)
|
|
|
-def control_ext_light():
|
|
|
+#@state_trigger("input_boolean.exterior_lights_wanted_state")
|
|
|
+#@task_unique("control_ext_light", kill_me=True)
|
|
|
+#def control_ext_light():
|
|
|
|
|
|
# Set max number of iterations
|
|
|
- maxIterations = 5
|
|
|
+# maxIterations = 5
|
|
|
|
|
|
# Loop until we have succeeded to controlling the light
|
|
|
+"""
|
|
|
while(
|
|
|
( (sensor.exterior_light_status != input_boolean.exterior_lights_wanted_state) or
|
|
|
( light.exterior_lights!= input_boolean.exterior_lights_wanted_state) ) and maxIterations > 0
|
|
@@ -52,4 +53,5 @@ def control_ext_light():
|
|
|
|
|
|
maxIterations -= 1
|
|
|
|
|
|
- log.info(f"Exit control_ext_light")
|
|
|
+ log.info(f"Exit control_ext_light")
|
|
|
+"""
|