I’m seeing an error when trying to use a variable defined inside a sequence of a script (originally the variable itself is defined using an input variable but I’ve simplified it to be set to a string and it still doesn’t work).
I have used variables in the past without issues in the very same installation but for some reason this fails with an error.
Could it be that specifically “state” conditions do not support templates?
I’m getting the this error
Taras if that’s ok I’ll mark Armedad’s as the solution going by ordering though I prefer using the is_state stynax personally.
I do wish HA was a bit more consistent and transparent about these things.
It’s never clear – both in the front end, and in the back ned – what fields support what templating and also when you need quotes vs not. For a new-comer it tends to seem kind of random.
((a bit of a non-constructive rant: and when you couple that with the fact YAML is not ‘compiled’ but interpreted I sometimes just have to take a big sigh to implement otherwise trivial seeming things because I know it will take tens of minutes if not hours fighting with the syntax (which is also often quite verbose to express basic things). I do love that the “Studio Code Server” addon I’m using seems to be aware of certain YAML rules but the custom HA stuff overlaid on top is not well supported. It would be amazing if we got more of an “IDE”. That or move everything to the UI. But I suspect the issue is resourcing for NabuCasa as most people probably do not pay for HA. So I get it will probably take years to get there… The product is amazing but it can also be incredibly frustrating. Still, beats anything else out there for me. And I really appreciate the dev team. /rant)
If it’s not explicitly mentioned in the documentation that an option supports templating and/or there’s no example employing a template for a given option, simply do not assume that it does.
Nowhere in the documentation for State Condition is it described or implied that the entity_id option supports templating (or its state option).
It’s your choice if you believe that’s the post that other readers should be led to in order to understand the problem and its solution.
Nobody pays for HA, it’s open-source and freely available.
Subscription fees paid to Nabu Casa are for remote access and other value-added services they provide. It’s sufficient revenue to allow them to employ over 30 people. If you look at the backlog of reported Issues (currently over 2700) and long-standing unfulfilled Feature Requests, it’s obvious their priorities lie elsewhere (i.e. HA Yellow, Green, SkyConnect, Matter, Voice Assistant, Grace, etc). The past five years have demonstrated that the bulk of the subscription fees don’t fund fixing mundane things (those are often left to volunteers) but for expanding Home Assistant in new directions.
The majority of new integrations, features, corrections, and technical support comes from unpaid volunteers who have limited time and resources.