I donât see anything wrong with it and canât explain why itâs not updating, unless sensor.power_consumption_normal is not changing. (Template sensors donât update unless the entity/entities theyâre watching change.)
On the other hand, I donât see the point of this template sensor â itâs just exactly mirroring the state of sensor.power_consumption_normal. Can you explain why you even have it?
I use it to monitor if its changing.
The state value is changing, but Meterstand electra hoog is not.
I use it to strip the decimals. Its working in dev templating.
This is the original sensor from my ISKRA AM550 power meter:
I think the issue might be that youâre using icon_template instead of icon. The value for icon_template does not contain any entities that it can find, so itâs probably deciding not to update. (You should see a warning.) Iâd suggest changing icon_template to just icon.
Not true. Unfortunately a lot of people seem to be coming to this incorrect conclusion. You only have to specifically list entities if the automatic entity extraction mechanism canât find entity_idâs for all the templates.
Hmm, it doesnât appear the template sensor has an option for icon. So you probably either have to list the entity_id source explicitly as @larsentim suggests, or maybe you can add the icon via customize.yaml. But I think the bottom line is the fact that icon_template does not contain an entity_id reference.
No, as long as you donât make a mistake and miss one of the entities or misspell something, or forget to update the list if/when the template is changed.
Yes, youâll probably save a few milliseconds during startup.
But seriously, the documentation doesnât describe how it automatically determines what entity/entities a template references. And unless you know that, itâs kind of hard to know if the template will update properly. E.g., it might only find some of the entities a template references. In that case you wonât get a warning â it just wonât work as you expect.
Documentation is all fine and good, but sometimes you have to read the code to understand how something might work in your particular situation. Or you can just ask on this forum, and maybe someone who has read the code, or will read the code to try and answer your question, will come along and help.
Personally, I know itâs the case when I get an error about it in the log file. I just added the sensors referenced to the entity idâs in those templates and it fixed it.
I had the same problem:
I moved the icon_template above the value template and it fired right up. Iâll watch it for a day or two and see if it keeps updated.
Itâs using an entity picture, not an icon but you get the idea.
See how I define the entities at the top⌠this means if those entity state changes it will re-evaluate the template. That is most probably the bit you are missing but you have not really posted anything usefulâŚ
Regarding the icon_template
I just want to change the default icon. Nothing fancy.
The verifier errors out on an âicon:â when included.
The verifier is quite happy to take the icon_template with a true (like saying if â1â, evaluates to true).
That does update the icon correctly but breaks the value logic (if it ever worked)
Regarding the value_template
Itâs starting to make sense now. The logic evaluates now() but if there are no other entities present there may never be anything changing which causes hydro_rate to be re-evaluated.
Is that what your are saying? If yes iâll have to create an entity that changes every hour and add it to the logic???
In your code youâve listed the entities you are evaluating in the entity ID section. That makes sense, to expose them there since they are buried in the template.