""" 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' }) kalle = kwargs.context.get("entity_id", None) ^ AttributeError: 'dict' object has no attribute 'context' """ # Mode Panel: # 1: All ON # 2: Windows # 3: Morning-mode # 4: All OFF @event_trigger( "button_pressed" ) def hallway_wall_button(entity_id=None): log.info(f"**************** got EVENT_CALL_SERVICE with {entity_id}") if( entity_id == 'switch.hall_switch' ): if( switch.group_button_all == 'on'): pyscript.state_goto_all_off() else: pyscript.state_goto_all_on() if( entity_id == 'switch.mode_panel_1' ): # All ON pyscript.state_goto_all_on() if( entity_id == 'switch.mode_panel_2' ): # Window pyscript.state_goto_window() if( entity_id == 'switch.mode_panel_3' ): # Morning pyscript.state_goto_morning() if( entity_id == 'switch.mode_panel_4' ): # All OFF pyscript.state_goto_all_off()