Switch / Contact in rrd4

Hi There,
I’m trying to make a chart of how often and for how long a switch and contact is on and off.
I’m using OH2 I have tried to make it with the MYSQL Persistance but I can’t get a graph from it as it stores ON or OFF values.
I have tried to use RRD4J but It does not seem to work @ all it can be because the periods of those items are small from 1s to 20s max.

This is the strategy I use:
rrd4j.persist:

Strategies {
	// for rrd charts, we need a cron strategy
	everyMinute : "0 * * * * ?"
}

Items {	
	// let's only store temperature values in rrd
	SWTest,CTTest : strategy = everyChange, everyMinute
	YTemperature : strategy = everyMinute, restoreOnStartup
}

rrd4j.cfg

# please note that currently the first archive in each RRD defines the consolidation
# function (e.g. AVERAGE) used by OpenHAB, thus only one consolidation function is
# fully supported
#
# default_numeric and default_other are internally defined defnames and are used as
# defaults when no other defname applies

#<defname>.def=[ABSOLUTE|COUNTER|DERIVE|GAUGE],<heartbeat>,[<min>|U],[<max>|U],<step>
#<defname>.archives=[AVERAGE|MIN|MAX|LAST|FIRST|TOTAL],<xff>,<steps>,<rows>
#<defname>.items=<list of items for this defname> 

ctr5min.def=GAUGE,900,-30,40,300
ctr5min.archives=AVERAGE,0.5,1,365:AVERAGE,0.5,7,300
ctr5min.items=YTemperature

any idea how to get around this ?

If it is not using a number to store switch states it won’t work in rrd4j at all. I’d recommend using the InfluxDB+Grafana approach, or at least the InfluxDB part. I’ve been charting switches in it successfully.

Thanks Rich!
This is what I was looking for! :smile: