I have a template sensor that is adding two numeric sensors together. The result is a sensor that drops values randomly, these drops do not appear in either of the individual sensors. Why does this happen?
The result of this is that I cant use the sensor for a trigger in my automation, I want it to trigger when the value stays above 0 for 20minutes which hardly ever because of the drops
One or both of your devices is going into unavailable /unknown state and not reporting a numeric state and your float(0) is defaulting that sensors data to zero.
Okay, so after further inspection I noticed that the individual values from the two sensors sometimes get the āunavailableā state from the modbus integration. These states equals ā0ā I guess, thus giving these valuesā¦ Can I get around this problem without using more sensors to filter this out? Like making hassio not recording the unavailable state in the logbook at all?
A bandpass-filter comes to mind but wont work because a sudden drop in value is quite natural in this environment. Suggestions?
saw your post when I posted mine
Can i make it not record anything instead or is there any easy fix?? Would be great if the ālast available valueā could be used in these cases
You donāt mention if you are using the new or legacy template sensor format and did not show your entire sensor, so this example is for the new format as it is what you should be using:
This will result in gaps in your graph if either of the source sensors are unavailable rather than odd values where one or the other sensor is set to 0 by the defaults for the filters you have used.
I think I run the legacy templates for most of my sensors unfortunately, too many of them to fix atm. But your fix worked flawlessly! No more dips in the graphs, thank you!
There is no need to update your existing sensors if they are working for you, but you should strongly consider the new format for any new sensors you create.