I’m trying to fire a state change event via the websocket API, but for some reason I can’t make it work.
I can successfully authenticate and receive state changes, so I’m sure my connection to the websocket API is ok.
This is what I’m sending (I’m incrementing the id on every call):
{
"id": 2,
"type": "fire_event",
"event_type": "state_changed",
"event_data": {
"entity_id": "sensor.my_power_sensor",
"state": 550,
"attributes": {
"unit_of_measurement": "W",
"friendly_name": "Powerful stuff",
"device_class": "power",
"state_class": "measurement"
}
}
}
And this is HA’s response:
{
"id": 2,
"type": "result",
"success": true,
"result": {
"context": {
"id": "01GQG6G6T8Z202RTBWRXWD0MZV",
"parent_id": null,
"user_id": "46a99b0006cd4ce6b89c2fbe191125dd"
}
}
}
I can do a similar call via the REST API to change the sensor and that works, but I can’t see any change via the websocket API.
I have tried state_change
instead of state_changed
but that does not make a difference.