Hey there,
apparently I’m too stupid for a probably pretty simple line of code…
I am in the process of completing my energy monitoring setup, which works like a charm with Shelly Plugs, Shelly EM, InfluxDB and Grafana.
To include all loads in my household, I want to avoid installing physical meters for loads that are more or less constant eg. my networking equipment.
I read a lot of threads, but somehow couldn’t figure out the easiest way of updating the template sensor every hour.
Can someone give me a heads up whether to use the Sensor.time, now().hourly or something entirely different and how to implement the code in the template? Would be very much appreciated!
Thanks for the suggestion! My intention was to use to use this sensor to calculate the kWh like with the “real” sensors, so I can use ist side by side. If there is another way to do that, I am open to go down that route!
I tried the automation, it executes every hour:
2021-02-08 10:00:00 INFO (MainThread) [homeassistant.components.automation.template_sensor_uptade_jede_stunde] Template Sensor update jede Stunde: Running automation actions
2021-02-08 10:00:00 INFO (MainThread) [homeassistant.components.automation.template_sensor_uptade_jede_stunde] Template Sensor update jede Stunde: Executing step call service
So far so good. But somehow I can’t select any entities with the homeassistant.update_entity action. When I manually add the sensor to the automation (like shown below), it isn’t updated as well…still shows as unavailable… Any ideas?
I created the exact same template sensor as you and the same automation to update it and it’s been working fine for the last 24 hours.
The only small change I made was to use a “every hour” update (‘/1’) instead of the wild card match. That’s the recommendation I made above but you used the wildcard match instead.