This is not very elegant. The two attributes in the first example above work, which means they are evaluated in the reverse order from how they are witten down. A second related problem is this template sensor created in the UI:
It listens to both sensors (from utility meter) which of course creates a short spike at every update. I could set an explicit trigger, but I would have to know which of the two is evaluated last. If there is no other solution I can stick with my time triggers a few seconds apart.
I don’t understand. Can you give a simple example? I can script actions but not sensors. When a template sensor is defined it gets evaluated (unless I set a trigger or condition to never). Do you mean a script with a sequence of “update entity” actions? I have this in an automation:
(It speeds up sensor readings from once every two minutes to once every five seconds to help me monitor changes on switching stuff on and off.) If I split that up into a sequence of separate actions, perhaps even with a slight delay in between, then I could determine a sequence. Is that really better than my current solution of staggered time triggers?
Thank you once more. Again it is you with the most helpful answer. I have never used (or even known how to use) variables before, but your example is very clear. So a list of variables can be relied on to stick to the order they’re written? I don’t need to split it up into a sequence of actions? Just to absolutely sure.
Danke