#I'm receiving `state_changed` (event
1 messages · Page 1 of 1 (latest)
Entire event data:
event_type: state_changed
data:
entity_id: event.hacomms_keyboard_combo_event
old_state:
entity_id: event.hacomms_keyboard_combo_event
state: "2024-07-28T04:40:04.282+00:00"
attributes:
event_types:
- keyboard_combo_pressed
event_type: keyboard_combo_pressed
combo_id: play_pause_music
friendly_name: HAcomms Keyboard Combo Event
last_changed: "2024-07-28T04:40:04.282857+00:00"
last_reported: "2024-07-28T04:40:04.282857+00:00"
last_updated: "2024-07-28T04:40:04.282857+00:00"
context:
id: 01J3VT6YDTJYHGKP924Y8X81AW
parent_id: null
user_id: null
new_state:
entity_id: event.hacomms_keyboard_combo_event
state: "2024-07-28T04:40:04.305+00:00"
attributes:
event_types:
- keyboard_combo_pressed
event_type: keyboard_combo_pressed
combo_id: play_pause_music
friendly_name: HAcomms Keyboard Combo Event
last_changed: "2024-07-28T04:40:04.305598+00:00"
last_reported: "2024-07-28T04:40:04.305598+00:00"
last_updated: "2024-07-28T04:40:04.305598+00:00"
context:
id: 01J3VT6YEH8J1HHSSHAS3RBTFJ
parent_id: null
user_id: null
origin: LOCAL
time_fired: "2024-07-28T04:40:04.305598+00:00"
context:
id: 01J3VT6YEH8J1HHSSHAS3RBTFJ
parent_id: null
user_id: null
In the Automation's "Event data" section I put this, because it's the only part I care about:
entity_id: event.hacomms_keyboard_combo_event
new_state:
attributes:
combo_id: play_pause_music
but it doesn't trigger. If I remove the new_state and everything underneath it, then it'll trigger, but regardless of what the combo_id is.
How can I correctly set that up to only trigger when that combo_id attribute is play_pause_music?
Correct. Trigger on all state changes and use a condition
.... or I could just respond to the State Change event with a condition.
Yup. Just found that. 🙂
Thank you!
Oddly enough, still doesn't work. I created an Automation, Trigger on State, selected my entity (an event), Attribute is "Combo ID" and To is "play_pause_music" but it doesn't fire. If I remove the Attribute information, then it fires for all state change regardless of the combo id.
If I put in Attribute Event type and select "keyboard_combo_pressed" from the dropdown, it still fails. So it's not a typo thing.
The attribute is 'event_type'
I send a payload:
{
"event_type": "keyboard_combo_pressed",
"combo_id": "music_play_pause"
}
But even when I match on the event_type string, it won't fire.
I selected those from the dropdown. I'll type it in manually.
okay, if I type combo_id in manually into the Attribute filed it selects "Combo ID"
Switching to YAML I can see it's correct.
UI doesn't matter. The YAML does
trigger:
- platform: state
entity_id:
- event.hacomms_keyboard_combo_event
attribute: combo_id
to: play_pause_music
The event you showed above doesn't show that attribute having changed
That's it. It's not changing. The event is being fired, but it's the same combo_id as above.
So trigger on all state change from that entity. What condition can I put to filter for that combo_id regardless of whether or not it changed?
Okay, I found it. Add the State condition and it doesn't filter the same way.
Just checks the current state. Exactly what I wanted.