fix: Match state trigger/condition semantics to HA (#2565)

* Closes #2530
This commit is contained in:
Dermot Duffy
2026-07-04 10:23:51 -07:00
committed by GitHub
parent 3494706225
commit 9f956fe89f
15 changed files with 825 additions and 69 deletions
+10
View File
@@ -500,6 +500,16 @@ Matches a Home Assistant entity's state. Unlike most types, the **condition** an
Both forms accept `entity` (or its `entity_id` alias) as a single entity or a
list.
Typing exactly mirrors Home Assistant behavior, but may be surprising:
- When `attribute` is set, the match values (`state` / `state_not` for a
condition; `from` / `to` / `not_from` / `not_to` for a trigger) are compared
against the raw attribute value using Home Assistant's equality rules, so they
may be any type and _must_ be written with that type: `state: 50` matches a
numeric attribute of `50`, whereas `state: '50'` (a string) does not.
Additionally in this case, Home Assistant treats `true` as equalling `1`.
- Without `attribute`, matching is strictly string-vs-string.
### As a condition
```yaml