wall_buttons.py 976 B

1234567891011121314151617181920212223242526272829303132333435
  1. """
  2. trigger file.wall_buttons.hallway_wall_button got event trigger, running action
  3. (kwargs = {
  4. 'trigger_type': 'event',
  5. 'event_type': 'button_pressed',
  6. 'context': Context(user_id=None,
  7. parent_id=None,
  8. id='67d442d5b0b4c1f3308417722801f709'),
  9. 'entity_id': 'switch.hall_switch',
  10. 'state': 'on'
  11. })
  12. kalle = kwargs.context.get("entity_id", None)
  13. ^
  14. AttributeError: 'dict' object has no attribute 'context'
  15. """
  16. @event_trigger( "button_pressed" )
  17. def hallway_wall_button(entity_id=None):
  18. log.info(f"**************** got EVENT_CALL_SERVICE with {entity_id}")
  19. if( entity_id == 'switch.hall_switch' ):
  20. if( switch.group_button_all == 'on'):
  21. pyscript.state_goto_all_off();
  22. else:
  23. pyscript.state_goto_all_on();
  24. if( entity_id == 'switch.mode_panel_1' ):
  25. pyscript.state_goto_all_on();
  26. if( entity_id == 'switch.mode_panel_4' ):
  27. pyscript.state_goto_all_off();