1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- from homeassistant.const import EVENT_STATE_CHANGED
- """
- trigger file.wall_buttons.hallway_wall_button got event trigger, running action
- (kwargs = {
- 'trigger_type': 'event',
- 'event_type': 'button_pressed',
- 'context': Context(user_id=None,
- parent_id=None,
- id='67d442d5b0b4c1f3308417722801f709'),
- 'entity_id': 'switch.hall_switch',
- 'state': 'on'
- })
- kwargs={
- 'trigger_type': 'state',
- 'var_name': 'input_select.light_mode',
- 'value': 'Morning',
- 'old_value': 'All on',
- 'context': <homeassistant.core.Context object at 0x7ff02cc49800>}
- # Mode Panel:
- # 1: All ON
- # 2: Windows
- # 3: Morning-mode
- # 4: All OFF
- @event_trigger(EVENT_CALL_SERVICE)
- def monitor_service_calls(**kwargs):
- log.info(f"got EVENT_CALL_SERVICE with kwargs={kwargs}")
- The events below (mode panel 1-4) are incoming as a rflink, newkaku-switch.
- """
- @event_trigger( "button_pressed" )
- def hallway_wall_button(entity_id=None, state=None):
- log.info(f"*************** * got EVENT_CALL_SERVICE with Id:{entity_id} State:{state}")
- if( entity_id == 'switch.hall_switch' ):
- pyscript.handleWallButtonPressed()
-
- if( entity_id == 'switch.mode_panel_1' ): # All ON
- input_select.light_mode = 'All on'
-
- if( entity_id == 'switch.mode_panel_2' ): # Window
- input_select.light_mode = 'Windows'
-
- if( entity_id == 'switch.mode_panel_3' ): # Morning
- input_select.light_mode = 'Morning'
-
- if( entity_id == 'switch.mode_panel_4' ): # All OFF
- input_select.light_mode = 'All off'
- if( entity_id == 'switch.mode_panel_kwl' ): # Kitchen work lights
- input_boolean.toggle(entity_id='input_boolean.kitchen_worklights')
- # This will trigger kitchen_worklights_button_trigger()
|