|
@@ -1,17 +1,56 @@
|
|
|
|
|
|
+"""
|
|
|
+def getCurrentState():
|
|
|
+ if( light.main_button_1 == 'on' && ) # All ON
|
|
|
+ light.main_button_2 == 'on' &&
|
|
|
+ light.main_button_3 == 'on' &&
|
|
|
+ light.main_button_4 == 'on' ):
|
|
|
+ return 1
|
|
|
+ elif( light.main_button_1 == 'off' && ) # Window
|
|
|
+ light.main_button_2 == 'off' &&
|
|
|
+ light.main_button_3 == 'off' &&
|
|
|
+ light.main_button_4 == 'on' ):
|
|
|
+ return 2
|
|
|
+ elif( light.main_button_1 == 'off' && ) # Morning
|
|
|
+ light.main_button_2 == 'on' &&
|
|
|
+ light.main_button_3 == 'off' &&
|
|
|
+ light.main_button_4 == 'on' ):
|
|
|
+ return 3
|
|
|
+ elif( light.main_button_1 == 'off' && ) # All OFF
|
|
|
+ light.main_button_2 == 'off' &&
|
|
|
+ light.main_button_3 == 'off' &&
|
|
|
+ light.main_button_4 == 'off' ):
|
|
|
+ return 4
|
|
|
+"""
|
|
|
+
|
|
|
@service
|
|
|
def state_goto_all_on():
|
|
|
-
|
|
|
log.info(f"********* ALL ON ***********")
|
|
|
-
|
|
|
switch.turn_on(entity_id='switch.group_button_all')
|
|
|
light.turn_on(entity_id='light.tradfri_bulb')
|
|
|
+ switch.turn_on(entity_id='switch.tradfri_outlet') # Sovrum ON
|
|
|
|
|
|
+@service
|
|
|
+def state_goto_window():
|
|
|
+ log.info(f"********* WINDOW ***********")
|
|
|
+ switch.turn_off(entity_id='switch.group_button_all')
|
|
|
+ light.turn_on(entity_id=' light.main_button_4')
|
|
|
+ light.turn_off(entity_id='light.tradfri_bulb')
|
|
|
+ switch.turn_on(entity_id='switch.tradfri_outlet') # Sovrum ON
|
|
|
|
|
|
@service
|
|
|
-def state_goto_all_off():
|
|
|
+def state_goto_morning():
|
|
|
+ log.info(f"********* MORNING ***********")
|
|
|
+ switch.turn_off(entity_id='switch.group_button_all')
|
|
|
+ light.turn_on(entity_id=' light.main_button_2')
|
|
|
+ light.turn_on(entity_id=' light.main_button_4')
|
|
|
+ light.turn_off(entity_id='light.tradfri_bulb')
|
|
|
+ switch.turn_off(entity_id='switch.tradfri_outlet') # Sovrum OFF
|
|
|
|
|
|
+@service
|
|
|
+def state_goto_all_off():
|
|
|
log.info(f"********* ALL OFF ***********")
|
|
|
-
|
|
|
switch.turn_off(entity_id='switch.group_button_all')
|
|
|
light.turn_off(entity_id='light.tradfri_bulb')
|
|
|
+ switch.turn_off(entity_id='switch.tradfri_outlet') # Sovrum OFF
|
|
|
+
|