HA has almost 2000 different integrations in core alone, not including all the many many custom ones in HACS and other places. How could it possibly know when a sensor has stopped working? The answer to that question varies wildly across those integrations. Some sensors check in so frequently that a second without an update is an issue. Some only change every other month and are totally fine in between.
Integration authors have a mechanism for specifying that there is a problem in the sensors created by that integration, they change its state to unavailable
or unknown
. The problem is we canât actually report that state to Influx. Influx expects things to have a consistent schema. So if you have a sensor with a numeric state then it expects to keep receiving a numeric value for the state of that sensor. If it gets handed the string unknown
or unavailable
as the state instead it has issues.
I would also question why Influx would need to know that. HA is an automation platform. It has all the sensors, it knows when they are unavailable
or unknown
and you can build an automation to react to that information which does whatever you want. Or if a particular integration you use doesnât have the capability to set a sensor to unknown
or unavailable
you can build a time-based check-in automation that takes an action when a sensor hasnât had a state change in too long. Why does it matter if Influx knows this information? What do you want to do with that information that HA canât?
As for the âre-report state every x minutesâ, there have been several issues and at least one PR about it and they were rejected. HA tracks state changes as its integrations tell them state has changed and acts on that information. The InfluxDB integration allows you to report those state change events out to another system (in this case Influx). Inventing fake state change events to fill gaps in InfluxDB functionality isnât where this integration wants to be. And in my opinion wouldnât even solve the problem? If you re-reported state changes every hour for instance you could still be hit with the fill()
issue if you picked any time range below an hour, where you found no data points and therefore had nothing to fill. Youâd have to speed up the re-reporting to every couple minutes and now you start to have a performance problem since the integration is doing so much work re-reporting that nothing has changed.
Kapacitor has the capability to write TICKscripts which run on Influxâs side and can do a lot of things. If you do want to do these things you can fill in both of these gaps on Influxâs side using TICKscripts. Robbie1221 shared a solution for doing so here