How to avoid NAN (not a number) in persistence / charts

Tags: #<Tag:0x00007f746cbdc5a8> #<Tag:0x00007f746cbe3268>

Hi,
I persist a lot of values to create charts, e.g. energy consumption.
Unfortunately in influxdb or rrd4j i get NAN (not a number) values in the database in the chart they are shown as very big or verx negative numbers (e.g. 4e8), which totally ruins the chart as the scale is so big now.

Is there a way to avoid these values being written into a database?

Fixing all these values manually is not possible, there are too much.

E.g. RRD4J

My first thought: Are you using Grafana for the graphs? If so I think there is a way of filtering the data to exclude values but you would have to dig around yourself because I know very little about how it works.
Second more obvious thought: Why are your sensors (? whatever is returning these values) sending these erroneous / off scale values? Fix that and the charts fix themselves. Where are these values coming for? Sensors? Plugs? or what?

First of all,
I have to apologize for being not precise.
The NAN values are not the problem, RRD4J filters them, but I have very few invalid values, e.g. 8e6 in my persisted series.

Actually these strange values come from ZWave power plugs. They track the energy consumption, but sometimes the values are non-sense.
But as they are persisted, they destroy the charts.

In the modbus extension, there is a “readTransform” function which can be used to call a JS function before transporting the values to the item, I use this one to skip NAN values.

Is there something similar for regular Things/Items?

Related thread

2 Likes