ソースを参照

Fix MQTT problem with unknown

pi 3 年 前
コミット
544a0f65a6
2 ファイル変更3 行追加3 行削除
  1. 2 2
      pyscript/ext_lights_control.py
  2. 1 1
      pyscript/home_automations.py

+ 2 - 2
pyscript/ext_lights_control.py

@@ -14,13 +14,13 @@ def ext_light_has_been_day():
     pyscript.ext_light_has_been_day = 'true'
 
 
-@state_trigger("int(sensor.lux_outside_the_garage) < 100", state_hold_false=0 )
+@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("int(sensor.lux_outside_the_garage) > 50", state_hold_false=0)
+@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'

+ 1 - 1
pyscript/home_automations.py

@@ -3,7 +3,7 @@
 state.persist('pyscript.home_auto_lights_off_has_been_night','false')
 
 
-@state_trigger("int(sensor.lux_outside_the_garage) > int(float(input_number.auto_light_off_lux_value))", state_hold_false=0)
+@state_trigger("sensor.lux_outside_the_garage != 'unknown' and int(sensor.lux_outside_the_garage) > int(float(input_number.auto_light_off_lux_value))", state_hold_false=0)
 def automate_home_auto_lights_off():
     if( pyscript.home_auto_lights_off_has_been_night == 'true' ):