|
@@ -143,49 +143,6 @@ def state_goto_all_off():
|
|
input_boolean.movie_mode = 'off'
|
|
input_boolean.movie_mode = 'off'
|
|
kitchen_worklights_button_trigger()
|
|
kitchen_worklights_button_trigger()
|
|
|
|
|
|
-# Reacts to when the Kitchen Worklights button is changed
|
|
|
|
-# This could be from HA UI or from web-interface
|
|
|
|
-@state_trigger("input_boolean.kitchen_worklights")
|
|
|
|
-def kitchen_worklights_button_trigger():
|
|
|
|
- log.info(f"Kitchen worklight changed. State: {input_boolean.kitchen_worklights}")
|
|
|
|
- if( input_boolean.kitchen_worklights=='on' or light.hall_door == 'on' ):
|
|
|
|
- log.info("Kitchen LED: Sec switch ON")
|
|
|
|
- if( switch.kok_led_sec_switch == 'on' ):
|
|
|
|
- log.info("K LED Sec Switch already On, go directly to PWW-Control")
|
|
|
|
- handle_kitchen_worklights()
|
|
|
|
- else:
|
|
|
|
- switch.turn_on(entity_id='switch.kok_led_sec_switch')
|
|
|
|
- else:
|
|
|
|
- log.info("Kitchen LED: Sec switch OFF")
|
|
|
|
- switch.turn_off(entity_id='switch.kok_led_sec_switch')
|
|
|
|
-
|
|
|
|
-# Triggers when the IKEA Switch changes state. Goes On or Off
|
|
|
|
-@event_trigger(EVENT_STATE_CHANGED, "entity_id=='switch.kok_led_sec_switch'")
|
|
|
|
-def kitchen_worklights_security_switch_trigger(entity_id, new_state, old_state):
|
|
|
|
- log.info(f"kitchen_worklights_security_switch_trigger() {switch.kok_led_sec_switch}")
|
|
|
|
- if( switch.kok_led_sec_switch=='on' ):
|
|
|
|
- log.info("Kitchen LED: Control PWM Wait...")
|
|
|
|
- task.sleep(0.5)
|
|
|
|
- log.info("Kitchen LED: Go....")
|
|
|
|
- handle_kitchen_worklights()
|
|
|
|
-
|
|
|
|
-# Controls the PWM of the kitchen workbench LED-Strips
|
|
|
|
-# Does not control the IKEA Switch that turns everything On/Off
|
|
|
|
-def handle_kitchen_worklights():
|
|
|
|
- log.info(f"handle_kitchen_worklights WL:{input_boolean.kitchen_worklights} HALL:{light.hall_door}")
|
|
|
|
- if( input_boolean.kitchen_worklights == 'on' ):
|
|
|
|
- log.info("K LED Full mode...")
|
|
|
|
- light.turn_on(entity_id='light.kitchen_worktop_4k',brightness='63')
|
|
|
|
- light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='127')
|
|
|
|
- elif( light.hall_door == 'on' ):
|
|
|
|
- log.info("K LED Soft mode...")
|
|
|
|
- light.turn_off(entity_id='light.kitchen_worktop_4k')
|
|
|
|
- light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='12')
|
|
|
|
- else:
|
|
|
|
- log.info("K LED Off mode...")
|
|
|
|
- light.turn_off(entity_id='light.kitchen_worktop_4k')
|
|
|
|
- light.turn_off(entity_id='light.kitchen_worktop_27k')
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -211,11 +168,11 @@ def movie_mode_button_trigger():
|
|
|
|
|
|
|
|
|
|
@event_trigger(EVENT_STATE_CHANGED, "entity_id=='input_button.av'")
|
|
@event_trigger(EVENT_STATE_CHANGED, "entity_id=='input_button.av'")
|
|
-def on_ui_button_all_off_clicken(entity_id, new_state, old_state):
|
|
|
|
|
|
+def on_ui_button_all_off_clicked(entity_id, new_state, old_state):
|
|
pyscript.state_goto_all_off()
|
|
pyscript.state_goto_all_off()
|
|
|
|
|
|
@event_trigger(EVENT_STATE_CHANGED, "entity_id=='input_button.allt_pa'")
|
|
@event_trigger(EVENT_STATE_CHANGED, "entity_id=='input_button.allt_pa'")
|
|
-def on_ui_button_all_on_clicken(entity_id, new_state, old_state):
|
|
|
|
|
|
+def on_ui_button_all_on_clicked(entity_id, new_state, old_state):
|
|
pyscript.state_goto_all_on()
|
|
pyscript.state_goto_all_on()
|
|
|
|
|
|
|
|
|