wall_buttons.py 751 B

12345678910111213141516171819202122232425262728
  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" , "entity_id == 'switch.hall_switch'")
  17. def hallway_wall_button():
  18. log.info(f"**************** got EVENT_CALL_SERVICE with kwargs=")
  19. if( switch.group_button_all == 'on'):
  20. pyscript.state_goto_all_off();
  21. else:
  22. pyscript.state_goto_all_on();