Persistence of nested groups

Hi all,

the past days I struggeled with my presence detection and got it now working in a way I think is fine for me.

Therefore I one group with type switch and OR-function for every person with switches in it that check for WLAN and BT availablity of the smart phones. One overall group holds all the items that should be used to check for presence in a rule:

Group:Switch gPresenceCheck
Group:Switch:OR(ON,OFF) gHandy1    (gPresenceCheck)
Group:Switch:OR(ON,OFF) gHandy2    (gPresenceCheck)
Switch Handy1_WLAN     (gHandy1)
Switch Handy1_BT       (gHandy1)
Switch Handy2_WLAN     (gHandy2)
Switch Handy2_BT       (gHandy2)

In the rules and sitemaps it works as expected but I also wanted to visulaze it in a chart and tried to persist all items that are in gPresenceCheck group:

gPresenceCheck* : strategy = everyChange

Unfortunately I can only see the real switches in my mysql database but the state of gHand1 and gHandy2 is never persisted.
I’m not 100% sure but think this was working in openhab 1.x

Is this intended behavior or am I doing something wrong?

Thanks in advance.

Regards,
Christian

Try an extra Group like

Group gMySQL "persistence service MySQL"

and then in mysql.persist

gMySQL* : strategy = everyChange

Actually tried it with a seperate Group to add additional Switch to the Chart but result is the same. Only lowest switch item is persisted

Items file:

Group Chart_Presence
Switch Presence               (Chart_Presence)

Group:Switch gPresenceCheck
Group:Switch:OR(ON,OFF) gHandy1    (gPresenceCheck,Chart_Presence)
Group:Switch:OR(ON,OFF) gHandy2    (gPresenceCheck,Chart_Presence)
Switch Handy1_WLAN     (gHandy1)
Switch Handy1_BT       (gHandy1)
Switch Handy2_WLAN     (gHandy2)
Switch Handy2_BT       (gHandy2)

mysql.persist

Chart_Presence* : strategy = everyChange

I noticed the same when setting up group based persistence. (Design Pattern: Group Based Persistence) It seems that groups need to be individually specified in the .persist file. Don’t know if it’s intended behavior or if it’s a bug, but I haven’t found another way around it. :confused:

I think it is intended behavior. Because Items can be members of multiple groups and subgroups and it is possible to create circular group dependencies, supporting persistence of subgroups could be more difficult to implement than one might expect.