Basically, you’re adding an availability template that checks if the sums of all the powers in the list are 0. If that’s the case, it’s not available for that moment. It will become available as soon as all the readings have a sum greater than zero. That moment in time will have ‘missing’ data, but it won’t affect the totals like 0 would.
You don’t have to use anchors, you can just list them out too…
OK, so the testing procedure was at fault and misleading you to believe the Smappee device wasn’t reporting 0 at certain times (but it actually was reporting 0).
You could change the template to replace a received 0 with the sensor’s existing value or use availability. However that effectively eliminates the possibility of ever reporting 0 even if it’s the true value. Is that acceptable for your application?
Thanks you very much. I’m going to recreate my configuration file with anchors and use your suggestion to use the sum of all power to make the entities available/unavailable.
Tested and confirmed working. If I now repost the faulty json all entities become unavailable untill smappe posts a new, correct, json topic. No more 0 in my charts
I do understand that it’s not retroactive but I resent the faulty json to MQTT a couple of times and every time I can see the HA chart going to 0 like before.
If I hover over that point it still shows “0 W” like it did before.
This is an example of such a chart. At the right you see it going to 0 multiple times. This happend after the changes, after restarting HA, and after I reposted the faulty json manually.
I see 0W when hovering over the last point, when I manually sent the faulty json.
I can see the entity going “unavailable” every time I manually repost that json. It comes back as soon as the smappee devices posts a new, correct, json.