I am trying to understand how to just show a blank/no value result when a sensor is offline, runs out of battery etc (data being sent via MQTT). Currently is just holds it’s last value. I have done some searching and some playing around and have not been able to accomplish this. Any help would be appreciated.
InfluxDB has what you send to it, no more, no less. If you want some other value in the database when something happens, you’d need to detect that condition and send other values.
Grafana does give some choices for when no data is present in the database. In the Queries, you can set to “fill(none)”. And in the Visualization, you can set the Draw Modes to points or bars instead of lines. Then you’ll see a point for every value, but won’t have connecting lines. So with no data, you won’t see anything.
Have you looked at expire binding? Made for this job. Choose a maximum time;if no update comes along within that time, set the Item state to “something” of your choice.
I would recommend setting to UNDEF in ordinary circumstances.
Persistence service will not record UNDEF (or NULL etc.)
There is no way to persist a not-useful value.
if you have a time based everyMinute strategy, you’d get gaps in your data, which may be what you want, rather than keep persisting “last good value”
Or, if you want somehow to record “bad-data” …
The closest you can get is to persist zero or -1 or -99 or some value that you know to be false, but that persistence will accept.
(That you can do with expire binding too.)
I don’t know if it possible to configure Grafana to ignore negative values etc.
This is possible, see below. Note that I believe it is InfluxDB doing the filtering as Grafana is just passing on the query.
One way to highlight a value is to use the builtin limit checking in Grafana. In the Alert section you can set a test for an alert, and one of the choices is “has no value”. See the second screenshot below.
Interesting how that might interact with what is recorded.
As said earlier, OH persistence cannot record “no value”.
So if you’re using some persist strategy like everyMinute, and set Item state to something like UNDEF, you get no records, gaps in the data. Which ought to fit the bill for Grafana?
Presumably though, if you’re persisting with an everyChange kind of strategy, the “no value” option is useless, as there is always no value between records at random times, but here it means “stayed the same”.
But it may not be “random”. It depends on the user’s sensor and what it is sensing. The user may know that a change always happens within a certain period of time. Also, this may be a case where a false positive is not a big deal. Maybe set the timeout to 24 hours. If 99.9% of the time a sensor reports in this time frame, then this is probably good enough. A bad battery or sensor is detected, and very rarely a false positive comes up.
Sure. See the context, I was pondering about persist records of change which can easily be erratic even with regular sensor reports, and how Grafana deals with that. Doesn’t affect any sensor timeout mechanisms.