Custom Events in Home Assistant

Custom Events in Home Assistant

Looking for a quick and easy way to fire custom events and subscribe to them in Home Assistant? Check out the following code…

Home Assistant Custom Events

The following two automations shows you how you can raise an event with [additional] data and catch that event and the corresponding data.

automation:
  - alias: Fire Event
    trigger:
      platform: state
      entity_id: switch.kitchen
    action:
      event: my_test_event
      event_data:
        foo: "bar"

  - alias: Capture Event
    trigger:
      platform: event
      event_type: my_test_event
    action:
      - service: script.notify_me
        data_template:
          message: "Test Event Captured with data foo: {{ trigger.event.data.foo }}"

comments powered by Disqus