Hi,
I’m trying to create a trigger based template sensor which is only triggered when a condition is met.
“condition” is listed as a configuration variable on the Template configuration page and there is even an example YAML code for a trigger based template with a condition. However, when I create the sensor in my config, I am getting the error “Property condition is not allowed”. Even when using the example code from the template configuration page gives the same error.
Has there been a change to the way conditions are set for a template sensors? Is there another way to achieve this?
Thanks,
Yes, condition
is a valid configuration key for trigger-based template sensors.
That “error” is coming from VSC/Studio Code’s extension, not HA. If your extensions are not up-to-date they will not reflect the actual current schema… and it is pretty common for the extension to lag behind HA updates.
The current version (5.18.1) of the Studio Code Server add-on does not show a warning for condition
.
1 Like
so then i have question:
shows conditions plural
here too.
Wouldnt it be more logical to have it the same on all places?
The key condition
is still usable in scripts and automations. The addition of the plural form conditions
is a recent change.
I don’t know if the pluralized forms were purposefully not added to trigger-based template entities or if it was just an accidental oversight. I am not a dev, but my understanding is that there are some significant updates/changes that will be required for the template integration to get Template Blueprints into the UI and/or expanded beyond just state-based sensors and binary sensors. Maybe the plurals weren’t addressed because it wasn’t worth the dev time for something that will need to be redone in the next year.
If it bothers you and you have the skills, feel free to submit a PR.
wasnt aware of that change. I dont have any skills to cover that, but I can put it as ‘explained’ away now
thx