Switch Item Persistence

I have a switch item tracking when an item is online/offline (not linked to the thing online).
I set up influxdb persistence so I could graph the stability.
In all other cases, this maps to 0 or 1 and if I log it regularly and on change I can get a decent square line chart to easily identify how stable the device is.

For one particular switch though, the values being stored are mostly 0/1 but with random decimal values in between resulting in a graph like this:

Anyone else seen this strange behaviour?

Have you told your charting to use influxdb? By default, OH3 charting uses the rrd4j service, with its averaging algorithms.

The chart in the original post is from the InfluxDB UI (Influx DB 2 on a separate machine). I tend to do all my charting in Grafana on top of Influx. Have many other charts working fine.

The built in charting still uses rrd4j, though that doesn’t seem to chart Switches.

In my influxdb.persist I have this

Can’t help with the root problem if you are certain that it’s charting from InfluxDB. But you can chart Switches in MainUI from rrd4j.

Don’t know if you already solved it but, for anyone else dealing with this this, I might have the reason why this happens. The InfluxDB data explorer adds the following aggregation statement by default:

  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)

If there is one 0 and one 1 in an aggregated time windows, this will result in an aggregated value of 0.5 and so on. You can remove that line by switching from the query builder to the script editor and the values should be as expected.