opened 07:58PM - 10 Feb 21 UTC
closed 01:29PM - 04 Jan 23 UTC
bug
## Expected Behavior
Switch states should show up in the graphs as ON/OFF area …diagrams.
I noticed this when the new charts were all working fine for number values but not for switch states. Persistence Service should return the same data as store in the influxdb.
## Current Behavior
With some help, I was able to figure out that the values of switch items retrieved from the persistence API do not reflect the values stored in the influx db.
`> select value from iPhone_Online
name: iPhone_Online
time value
---- -----
1612954910668000000 0
1612954931794000000 1
1612954996835000000 0
1612955122916000000 1
1612955971594000000 0
1612956031705000000 1
1612956096732000000 0
1612956221874000000 1
1612956286901000000 0
1612956607030000000 1
1612956672098000000 0
1612956732145000000 1
1612956917395000000 0
1612957225425000000 1`
(partial) JSON Output from the API Explorer:
> {
> "name": "iPhone_Online",
> "datapoints": "77",
> "data": [
> {
> "time": 1612954910668,
> "state": "OFF"
> },
> {
> "time": 1612954931794,
> "state": "OFF"
> },
> {
> "time": 1612954931794,
> "state": "OFF"
> },
> {
> "time": 1612954996835,
> "state": "OFF"
> },
> {
> "time": 1612954996835,
> "state": "OFF"
> },
> {
> "time": 1612955122916,
> "state": "OFF"
> },
> {
> "time": 1612955122916,
> "state": "OFF"
> },
> {
> "time": 1612955971594,
> "state": "OFF"
> },
> {
> "time": 1612955971594,
> "state": "OFF"
> },
> {
> "time": 1612956031705,
> "state": "OFF"
> },
> {
> "time": 1612956031705,
> "state": "OFF"
> },
> {
> "time": 1612956096732,
> "state": "OFF"
> },
> {
> "time": 1612956096732,
> "state": "OFF"
> },
Three things of note:
1st: within influxDB the timestamps are zero padded (probably not a problem)
2nd: all values except the first return twice
3rd: all values are “OFF”
This seems to be an issue for all switch ON/OFF items. Number items are working fine.
See also this thread in the community forum:
https://community.openhab.org/t/analyze-charts-not-working-for-switches/116683
## Possible Solution
It looks like it might be a mapping issue? 1 from Influx DB apparently doesn't get mapped to ON in the persistence service.
I have no explanation for the data duplication though.
## Your Environment
influxdb is the only and default persistence service
Influx.persist file:
`Strategies {
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
default = everyUpdate
}
Items {
iPhone_Online : strategy = everyChange
RestoreOnStartup : strategy = restoreOnStartup
}`
openHAB 3.0.0 Release Build (Upgraded from OH2.4 via openhabian)
influxDB Persistence 3.0.0
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.8.3