Persisting groups (MariaDB)

Hi there,

somehow this doesn´t work for me:
Items:

Group grBaseTEMP_SENSOR
Group grErdgeschossTEMP_SENSOR ( grBaseTEMP_SENSOR )

Number temperature_erdgeschossbuerobuero “Temperature [%.1f °C]” (grErdgeschossTEMP_SENSOR,grErdgeschossTEMP_AVERAGE) { knx=“4/1/2+<9.001:4/1/8” }

jdbc.persist

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
	every10Minutes : "0 0/10 * * * ?" 
	everySecond :  "0 * * * * ?" 
}

Items {
	//grErdgeschossBueroLIGHT* : strategy= everyChange
	grBaseTEMP_SENSOR* : strategy= everyChange
	//* : strategy= everyChange
	
}

// vim: syntax=Xtend syntax=openhab

but this does:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
	every10Minutes : "0 0/10 * * * ?" 
	everySecond :  "0 * * * * ?" 
}

Items {
	//grErdgeschossBueroLIGHT* : strategy= everyChange
	//grBaseTEMP_SENSOR* : strategy= everyChange
	* : strategy= everyChange
	
}

// vim: syntax=Xtend syntax=openhab

Normally with * every Item in that group should get persistet, or am I wrong ?

Correct

Strange that your first example doesn’t work… It looks ok
I have a similar setup and it works for me
I have a main group with subgroups and the items are members of the subgroups.
I persist everything within the main group and this captures also the items…

I don’t think the persistence config works recursively. Given your Items above I think your persist config would only save the aggregated state of the Group grErdgeschossTEMP_SENSOR. You would have to either add temperature_erdeschossbuerobuero to grBaseTEMP_SENSOR or add grErdeschossTEMP_SENSOR* to the .persist file.

Personally I recommend creating separate persistence specific Groups and add all Items you want to persist to these special groups in addition to other groups you may have for other purposes. See the following:

That is true but the only “item” in grBaseTEMP_SENSOR is grErdgeschossTEMP_SENSOR. I don’t think is recurses into subgroups.

It does.

My setup:

groups.items:

/* Control Groups */
Group	All
Group	gInflux		(All)
Group	gKNX		(gInflux)
Group	gZWave		(gInflux)
Group	gmPower		(gInflux)

mPower.items:

Switch		mP6_01_01_O	"mP6_01_01 Outlet"		<switch>	(gmPower)	{channel="mpower:socket:04_18_D6_54_1B_B7:1:outlet"}
Number		mP6_01_01_P	"mP6_01_01 Power [%.1f W]"	<energy>	(gmPower)	{channel="mpower:socket:04_18_D6_54_1B_B7:1:power"}
Number		mP6_01_01_E	"mP6_01_01 Energy [%d Wh]"	<energy>	(gmPower)	{channel="mpower:socket:04_18_D6_54_1B_B7:1:energy"}
Number		mP6_01_01_V	"mP6_01_01 Voltage [%d V]"	<energy>	(gmPower)	{channel="mpower:socket:04_18_D6_54_1B_B7:1:voltage"}
DateTime	mP6_01_01_U	"mp6_01_01 Update [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<text>	(gmPower)	{channel="mpower:socket:04_18_D6_54_1B_B7:1:lastupdate"}

Same story with my KNX and ZWave items (they are members of their gKNX and gZWave groups respectively)

Conclusion:
mPower Items are members of the gmPower group which is a member of the gInflux group.

Then, in my influxdb.persist:

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    default = everyChange
}

Items {
    // persist all members of gInflux Group on every change
    gInflux* : strategy = everyChange, everyHour, everyDay
}

And all individual items get persisted fine.

1 Like

Could it depend on which persistence-type you’re using?
I’m using JDBC - MySQL, and that’s also having problem when I trying to collect item-data based on a group. :frowning:
As soon as I’m changing it back to “* : strategy = everyChange, everyDay, restoreOnStartup”, it works perfect.
(But then I start seeing problem in the log about non-unique/dublicate records). :expressionless: |