blackhome assistantautomation
Automatyzacja z wykorzystaniem encji Event w Home Assistant
Automatyzacja wykorzystująca encje Event w HA.
• Pawel

Home Assistant w wersji 2023.8 wprowadził nowe encje Event. BoneIO Black już przyjął te encje. To naprawdę fajne!
Jak używać encji Event w aplikacji boneIO już wiesz z dokumentacji. Teraz czas na kontrolowanie ich z automatyzacji Home Assistant.
Przykład
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: trueWyjaśnienie
To jest całkiem proste. Wyzwalacz czeka na encję event, z wyjątkiem powrotu ze stanu niedostępny (restart aplikacji boneIO lub Home Assistant). W akcji możemy sprawdzić czy typ eventu to single, double czy long.