Problem with Charting of Switch States


I’ve got a problem with the Charts.
I want to show the status of some switches over the last week.
My data is saved via the mysql persistens, which shouldn’t be the problem, the charts are working for the number items I use.

The Chart in the sitemap that doesn’t work is this:
Chart item=mySwitchA service=“mysql” period=W refresh=120000indent preformatted text by 4 spaces

The Item is configured in a .item-file:
Switch mySwitchA (Schalter) {enocean="{id=FE:FA:D8:9C, eep=F6:02:01, channel=A}"}

Does someone of you see the Problem or knows if you need to do something special with Switch-Items?

I can’t speak to MySQL but I know that some persistence databases, notably rrd4j, do not store Switch Items as Numbers and therefore they cannot be charted. Look at your table and see what sort of column type it is using to store your switch. If it isn’t a numerical data type then you won’t be able to chart it.

I do know that InfluxDB does (or at least used to recently) store Switches as 1/0 for ON/OFF.

If it doesn’t store them as numbers, you will need to create an unbound item (aka virtual item) that is a Number which gets saved to the DB and which gets updated with 1/0 when your mySwitchA changes.

I have problems display on/off switches in OH3 charts.

On my OH3 test system I was able to display switches in charts using RRD4j persitance service.

But my production OH3 system does not display them.
I’m running OH 3.0.1 on ubuntu system with influxDB persitance service.

My switch item stored correctly to influxdb with 0/1 values:

select * from astroIsDayLight where time = 1614711600649000000
name: astroIsDayLight
time item value

1614711600649000000 astroIsDayLight 0

select * from astroIsDayLight
1614697200974000000 astroIsDayLight 1
1614700800033000000 astroIsDayLight 1
1614704400085000000 astroIsDayLight 1
1614705060007000000 astroIsDayLight 0
1614708000587000000 astroIsDayLight 0
1614711600649000000 astroIsDayLight 0

But in chart no data displayed. Using the chart’s data table option I found that values seems to be not numeric:
openHAB3 chart, Data table:

1614697200974 NaN
1614697200974 NaN
1614700800033 NaN
1614700800033 NaN
1614704400085 NaN
1614704400085 NaN
1614705060007 NaN
1614705060007 NaN
1614708000587 NaN
1614708000587 NaN
1614711600649 NaN
1614711600649 NaN

How can I fix this?

Tagging on to a four year old post … this one is more recent

I didn’t found this topic, probably used the worng search keys.