I have created a filter that smooths out changes in the grid load that is reported by my inverter. This is useful in automations which might otherwise be thrown by sudden spikes and dips in load.
However, because I am in South Africa and we get regular load shedding (2h scheduled rolling black-outs), when the grid drops, no data is reported by the inverter (I assume because there is no change in state). This seems to have the net effect that my filtered sensor “freezes” on the last calculated value.
This has the effect that some automations, which depend on knowing if there is a loss of grid supply, don’t fire. I should say that the purpose of the filter was mostly to allow for the 40W synchronisation draw from the inverter. The raw sensor report this as zeroes and spikes that are not insignificant. When everything’s operational, the filter seems to work very well.
I’ve tried to use a time-based moving average, but still, in the absence of data, nothing seems to change.
The sensor has this configuration:
(Apologies for screenshots - file editor on mobile does not allow for copy/paste )
Any thoughts?
One alternative would be to add in a check to see how long ago that sensor was updated and ignore it if it was updated over 1 minute ago. But I can’t work out how to add that condition to an automation - specifically how to test that something was last updated more or less than a specific time ago?
Another is to put this filtered sensor through a template which will give me complete control over it…
First prize is just to configure one thing (the filtered sensor) to just “work”…