Subscription filter
The exact shape subscribe() accepts, as JSON schema.
The filter is validated strictly when subscribe() runs: unknown keys throw, which aborts the installed() or updated() call that made the subscription.
| Key | Meaning |
|---|---|
{} | Any change: state or attribute. |
to | Fire only when the state becomes this value — a raw token ('on') or the friendly label the app shows for the entity ('Open'), any case or separator. |
from | Fire only when the state leaves this value (combine with to for an exact transition). Same raw-or-label rule. |
state | Legacy alias of to. Never combine with to. |
attribute.name | Watch one attribute instead of the state. |
attribute.value | Only when that attribute becomes this value; omit for any change. |
Allowed keys: from, to, state, attribute.
Labels are resolved at match time
The filter is stored exactly as written. When an event arrives the hub compares the raw token first, then resolves a label through the entity's domain and device class ('Open' is on for a door sensor and open for a cover). { to: 'on' } and { to: 'Open' } for the same handler collapse to one subscription. Labels never resolve for numeric domains (sensor, input_number, counter).
JSON schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"state": {
"type": "string"
},
"attribute": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"value": {}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"additionalProperties": false
}