RRD4j and switch persistence

I read that the switch type items should be supported and stored as 0/1 instead of OFF/ON
I tried to define this item:

`String Z1_actuator “ON/OFF [%s]” (Zona1, Chartsonoff) {channel=“openwebnet:bus_thermo_zone:mhs1:Thermgiorno:actuators”}

Strategies {
everyMinute : “0 * * * * ?”
}
Items {
// persist items on every change and every minute
Z1_actuator, Z2_actuator, Z1_Temp, Z2_Temp, Netatmo_Indoor_Temp, Netatmo_Outdoor_Temp : strategy = everyMinute, restoreOnStartup
}`

To use in a sitemap chart Chartsonoff displaying the state of the actuator, but the persistence file is not created also when the Item change state:

2021-10-06 16:07:53.534 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Z1_actuator’ changed from OFF to ON
2021-10-06 16:09:24.962 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Z1_actuator’ changed from ON to OFF

How can I fix it?

Please give us some more information.

Which openHAB version? Your used item definition suggest openHAB 1 ( really? )

Did you install the rrd4j persistence?

How did you check whether a persitence file was created? You do know that for each persisted item a file should have been created!

Excuse me:
openHAB 3.2.0 Build #2446 on Raspberry PI4
I moved files from OH 2.5 via backup restore into a new installation
I have rrd4j installed and defined as default persistence, it’s already working well for other charts.
In /var/lib/openhab/persistence/rrd4j I see several rrd files for items I already have but no file for the new switch type I added in these days. All previous stored data are numbers:temperature. Only the new ones are switch that return a string ON/OFF
I never created files in this folder, should I create a new one? How?

I have to excuse myself!
Your item definition is correct (and not in the OH1 syntax, stupid .me).

I wo der if you rrd4j setup is still working. My guess is that the already editing .rrd files were created from the default ( rrd4j) setup ( which is working without instslling rrd4j and 2ithout setting it as default manually) . Creating an own setup did stop that one.
Do you see updates the old .rrd files?
I’d try to restart the rrd4j bundle ( no need the restart openHAB in toto).
Creating the .rrd files by hand is never needed!

I have already restarted it several times. Now I started debugging rrd4j and I saw this interesting message:
2021-10-07 08:18:56.702 [DEBUG] [d4j.internal.RRD4jPersistenceService] - Did not create rrd4j database for item ‘Z1_actuator’ since no rrd definition could be determined. This is likely due to an unsupported item type.
2021-10-07 08:18:56.705 [DEBUG] [d4j.internal.RRD4jPersistenceService] - Could not find item ‘Z1_actuator’ in rrd4j database
It looks as switches are no more supported, also if they are still listed

NOTE: rrd4j is for storing numerical data only. It cannot store complex data types. The supported item types are therefore only Switch (internally mapped to 0/1), Dimmer, Number, Contact (internally mapped to 0/1), Rollershutter and Color (only brightness component stored).

:thinking:
I’m not persisting any ON/OFF item, so I can’t really say.

Z1_actuator looked to be defined as a String not Switch

2 Likes

Me stupid! Copied the wrong line. It was the first switch I needed to store in rrd4j, so I did not notice that I took the line where I read the status of that actuator, because I do not need to control it, but only to know if it’s open or close.
Now I defined a new line and the persistence file is created!
Please excuse me for my error.

@MikeJMajor Good catch!

@fmalfatto Noboby is perfect (as can be seen in my initial post).

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.