Group state not updating, reboot solves it

I just had this annoying issue that a group’s state was not updating when one of the items’ state was updated. I tried touching the items file so it would reload, but this didn’t solve the problem. A reboot did.

Here are the group and item definitions (there are more items in the group than shown below):

Switch Logic_Presence_H2			"Aanwezigheid H2"	(gLogic, gPresence)		{ knx="<13/0/2" }
Group:Switch:OR(ON, OFF)  gPresence 		"Aanwezigheidsdetectie" (All)

Logging of the issue:

2017-12-17 10:00:44.583 [ItemCommandEvent          ] - Item 'Logic_Presence_H2' received command ON
2017-12-17 10:00:44.592 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from OFF to ON
2017-12-17 10:00:51.639 [ItemCommandEvent          ] - Item 'Logic_Presence_H2' received command OFF  
2017-12-17 10:00:51.649 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from ON to OFF  

After reboot everything works correctly:

2017-12-17 10:03:17.422 [ItemCommandEvent          ] - Item 'Logic_Presence_H2' received command ON
2017-12-17 10:03:17.428 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from OFF to ON
2017-12-17 10:03:17.429 [GroupItemStateChangedEvent] - gPresence changed from OFF to ON through Logic_Presence_H2
2017-12-17 10:03:20.939 [ItemCommandEvent          ] - Item 'Logic_Presence_H2' received command OFF
2017-12-17 10:03:20.943 [GroupItemStateChangedEvent] - gPresence changed from ON to OFF through Logic_Presence_H2
2017-12-17 10:03:20.944 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from ON to OFF  

When I look in my logging, the last time it was still working was yesterday afternoon. I did some change to my items file that contains all groups. I added a new group, no other changes. So this triggered a reload of this file, and there was an update of the gPresence group state from NULL to ON. After this, no updates anymore until I the reboot. These are the last 2 updates:

2017-12-16 16:45:24.380 [GroupItemStateChangedEvent] - gPresence changed from OFF to ON through Logic_Presence_KEU  
2017-12-16 16:45:29.051 [GroupItemStateChangedEvent] - gPresence changed from NULL to ON through Logic_Presence_H1  

Any ideas what might be causing this?

  • Platform information:
    • Hardware: RPI
    • OS: Openhabian 4.4.50-v7+
    • Java Runtime Environment: OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
    • openHAB version: 2.1.0-1

Was your group ON already?
You defined your group state to be OR(ON, OFF), so the group state depends not just on Logic_Presence_H2 but on the states of all other members of gPresence, too (which are probably initialized to all-OFF on OH startup after a reboot that’s why in that case to change your switch state makes the group state change).

The group was rightfully changed to ON yesterday after the model reload. Afterwards, presence of all items in the group has been OFF several times. All items in the group are set by presence detectors, about 12 of them, and they do not cover the entire house. So the value of gPresence should have definitely been set to OFF afterwards.

Here’s the entire logging from events.log of what happened after the model reload:

2017-12-16 16:45:28.335 [ItemStateChangedEvent     ] - Logic_AbsenceMode changed from NULL to OFF
2017-12-16 16:45:28.349 [ItemStateChangedEvent     ] - Logic_Presence_H1 changed from NULL to OFF
2017-12-16 16:45:28.364 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from NULL to OFF
2017-12-16 16:45:28.378 [ItemStateChangedEvent     ] - Logic_Presence_H3 changed from NULL to OFF
2017-12-16 16:45:28.392 [ItemStateChangedEvent     ] - Logic_Presence_H0 changed from NULL to OFF
2017-12-16 16:45:28.409 [ItemStateChangedEvent     ] - Logic_Presence_H15 changed from NULL to OFF
2017-12-16 16:45:28.422 [ItemStateChangedEvent     ] - Logic_Presence_BER changed from NULL to OFF
2017-12-16 16:45:28.446 [ItemStateChangedEvent     ] - Logic_Presence_DRE changed from NULL to OFF
2017-12-16 16:45:28.473 [ItemStateChangedEvent     ] - Logic_WeekendMode changed from NULL to ON
2017-12-16 16:45:28.486 [ItemStateChangedEvent     ] - Logic_Presence_BAD changed from NULL to OFF
2017-12-16 16:45:28.499 [ItemStateChangedEvent     ] - Logic_Presence_TOI changed from NULL to OFF
2017-12-16 16:45:28.516 [ItemStateChangedEvent     ] - Logic_Presence_KEU changed from NULL to ON
2017-12-16 16:45:29.033 [ItemStateChangedEvent     ] - Logic_AbsenceMode changed from NULL to OFF
2017-12-16 16:45:29.049 [ItemStateChangedEvent     ] - Logic_Presence_H1 changed from NULL to OFF
2017-12-16 16:45:29.051 [GroupItemStateChangedEvent] - gPresence changed from NULL to ON through Logic_Presence_H1
2017-12-16 16:45:29.068 [ItemStateChangedEvent     ] - Logic_Presence_H2 changed from NULL to OFF
2017-12-16 16:45:29.079 [ItemStateChangedEvent     ] - Logic_Presence_H3 changed from NULL to OFF
2017-12-16 16:45:29.092 [ItemStateChangedEvent     ] - Logic_Presence_H0 changed from NULL to OFF
2017-12-16 16:45:29.106 [ItemStateChangedEvent     ] - Logic_Presence_H15 changed from NULL to OFF
2017-12-16 16:45:29.118 [ItemStateChangedEvent     ] - Logic_Presence_BER changed from NULL to OFF
2017-12-16 16:45:29.142 [ItemStateChangedEvent     ] - Logic_Presence_DRE changed from NULL to OFF
2017-12-16 16:45:29.165 [ItemStateChangedEvent     ] - Logic_WeekendMode changed from NULL to ON
2017-12-16 16:45:29.187 [ItemStateChangedEvent     ] - Logic_Presence_BAD changed from NULL to OFF
2017-12-16 16:45:29.204 [ItemStateChangedEvent     ] - Logic_Presence_TOI changed from NULL to OFF
2017-12-16 16:45:29.217 [ItemStateChangedEvent     ] - Logic_Presence_KEU changed from NULL to ON
2017-12-16 16:45:29.482 [ItemStateChangedEvent     ] - Light_KEU_LedStripAanrecht changed from 7 to 100
2017-12-16 16:45:33.026 [ItemCommandEvent          ] - Item 'LightValue_H0' received command 0.0 

These are all items in the gPresence group:

Switch Logic_Presence_KEU			"Aanwezigheid keuken"			(gLogic, gPresence)		{ knx="<1/0/15" }
Switch Logic_Presence_TOI			"Aanwezigheid toilet"			(gLogic, gPresence)		{ knx="<2/0/0" }
Switch Logic_Presence_BER			"Aanwezigheid berging"			(gLogic, gPresence)		{ knx="<3/0/0" }
Switch Logic_Presence_GAR			"Aanwezigheid garage"			(gLogic, gPresence)
Switch Logic_Presence_LIV			"Aanwezigheid living"			(gLogic, gPresence)
Switch Logic_Presence_DRE			"Aanwezigheid dressing"			(gLogic, gPresence)		{ knx="<7/0/0" }
Switch Logic_Presence_BAD			"Aanwezigheid badkamer"			(gLogic, gPresence)		{ knx="<8/0/10" }
Switch Logic_Presence_H0			"Aanwezigheid H0"				(gLogic, gPresence)		{ knx="<13/0/0" }
Switch Logic_Presence_H1			"Aanwezigheid H1"				(gLogic, gPresence)		{ knx="<13/0/1" }
Switch Logic_Presence_H2			"Aanwezigheid H2"				(gLogic, gPresence)		{ knx="<13/0/2" }
Switch Logic_Presence_H3			"Aanwezigheid H3"				(gLogic, gPresence)		{ knx="<13/0/3" }
Switch Logic_Presence_H15			"Aanwezigheid H1.5"				(gLogic, gPresence)		{ knx="<13/0/4" }

Now that I look at this in detail, I think I see a potential problem. 2 of the Items in the group have no binding (I have no physical detectors for them yet). So they always have value NULL. I just read that an OR(ON,OFF) would set the group to ON if any item in the group is ON, but only to OFF if all of them are OFF. Since NULL is not OFF, that never happened.
Is this the correct analysis?
If yes, shouldn’t it be better to ignore NULL states?

No, this says that if no member is ON (i.e. if they’re all either OFF or NULL), OFF is returned.

I wouldn’t use the OR(…) logic anyway as in terms of presence detection, you should be aware that sensors can produce false positives, so I’d suggest to check for a quorum such as 2 (means: have at least 2 sensors ON before you consider this to be a a signof presence).
To get there, you cannot use built-in functions anyway but need to program your own (i.e. a lambda).

No, this1 says that if no member is ON (i.e. if they’re all either OFF or NULL), OFF is returned.

You’re right, so something else is going on. Anyway I removed the items without bindings, let’s see if it happens again.

I wouldn’t use the OR(…) logic anyway as in terms of presence detection, you should be aware that sensors can produce >false positives, so I’d suggest to check for a quorum such as 2 (means: have at least 2 sensors ON before you consider >this to be a a signof presence).

Don’t worry, I’m not using this group directly to determine presence. This just groups all my presence detectors in the house. For now I use it to set a ‘last presence detected’ timestamp in a script, and cron trigger to check if this timestamp grows older than 2h. If yes, my global presence item goes OFF.
I just quickly slammed this together to help automate my christmas lights :slight_smile: This will evolve into something more intelligent.

Check out my presentation on presence detection.

Your link is broken, I’d love to see it. can you please update the link?

Search for “Markus” in that URL

Oh, thank you. I’ve actually watched these before. I’ll watch them again as the topic is still very interesting to me.

1 Like