Event entities automation in Home Assistant


Home Assistant in 2023.8 introduced new event entities. BoneIO Black has already adopted this entities. It’s pretty cool!

How to use event entities inside boneIO App you already know from documentation. Now time to control it from Home Assistant automation.

Example

alias: IN_04
description: ''
trigger:
  - platform: state
    entity_id:
      - event.boneio_beagle1_in_04
    not_from:
      - unavailable
condition: []
action:
  - alias: Actions for IN_04
    choose:
      - conditions:
          - condition: state
            entity_id: event.boneio_beagle1_in_04
            attribute: event_type
            state: single
        sequence:
          - service: light.toggle
            data: {}
            target:
              entity_id: light.kitchen
      - conditions:
          - condition: state
            entity_id: event.boneio_beagle1_in_04
            attribute: event_type
            state: long
        sequence:
          - service: switch.toggle
            data: {}
            target:
              entity_id: switch.pump
            enabled: true

Explanation

It’s pretty simple. Trigger waits for event entity, except for coming back from unavailable state (restart of boneIO app or Home Assistant). In action condition we can check if event type is single, double or long.