Off the wall suggestion, based on assumed iterative calculation of Group state (maybe only for OR function even)
When a member changes, it fires a process to step through all candidate members, first setting the group state to the default. If there’s no match to the OR condition, it stays default. If there is match, it changes again.
Seems mad but this behaviour can be deduced from rule trigger firings.
I’d guess the first change event i.e. from NULL to X, is suppressed.
@ysc I can confirm your observations. Did it myself in a test setup. This leaded me to another question I wanted to test: Which event will we see when we have a group containing only one member:
Outch, again failing - GroupItemStateChangedEvent is missing.
I did the same tests with a group containing two members. Ping me if you ate interested in the results. // EDIT: I added them below. They reflect your findings.
IIRC the unit tests only handle updateState() on items. sendCommand() on groups is NOT covered!
Conclusion: First of all forget about my suggestion to trigger an ItemStateChangedEvent. We do not need it. There is something wrong with the calculation at which time a GroupItemStateChangedEvent will be emitted. Lets open an issue on Issues · openhab/openhab-core · GitHub.
I have noticed a similar problem -> items changing not generating a group event. I can fix it by editing the .items file and saving it which reloads the items. I haven’t had time to dive into this to definitely understand the problem. But, something has changed and events have gone missing…
Revisiting this topic, that we never really never got to the bottom of.
On the face of it, that is a “dumb” thing to do. This Group’s state is calculated by an aggregation function. Sending a direct postUpdate to a Group is an abnormal usage. Having said that, it’s a meaningful test …
If we interpret ItemStateChangedEvent
as meaning “I have been changed by a postUpdate”
(and I guess an update by binding should do this too)
and GroupItemStateChangedEvent
as meaning “I have been changed by group member aggregation function only”
In other words, this is a “group” calculated event not an ordinary “real” event
Then Cristoph’s results look to be the intended behaviour ??
If we can establish what expected behaviour is, then we can pick out the unexpected “missing” events.
After upgrading to OH 2.5.0 I’m also experiencing the same behavior in HABPanel as stated in the initial post in this thread. After pressing on a group switch, the status in not updated until a page reload has been done. It worked flawlessly before on 2.4.0. Is there a workaround available? And did someone open an issue for this? I could not find any on GitHub (openhab/openhab-core). Thanks!
I just updated from 2.4 to 2.5 and have exactly this same problem.
I had no issues with this before upgrade to 2.5.
Would it be possible to revert only habpanel binding to 2.4? Or any other workaround?
Thanks!
same here on 2.5.
Without manual refresh group item sticks to one state and keeps posting same every time I toggle group switch.
Testing scenario:
Group ‘garaz_zew’ containing 3 items (bulbs)
starting state OFF
Test1 Test1 expected result:
When group swith toggled: Group item command = ON
Habpanel switch widget representing status ON Test1 end result:
Group item received command ON - success
Habpanel item status not changed - fail
Test2 Test2 expected result:
When group swith toggled: Group item command = OFF
Habpanel switch widget representing status OFF Test2 end result:
Group item received command OFF - fail
Habpanel item status not changed - fail
All of the next tryouts gives the same result. ItemCommandEvent keeps sending ON state every time the group swich toggle:
[ome.event.ItemCommandEvent] - Item ‘garaz_zew’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_S’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_P’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_L’ received command ON
[vent.ItemStateChangedEvent] - Garaz_zew_S changed from 0 to 100
[vent.ItemStateChangedEvent] - Garaz_zew_P changed from 0 to 100
[vent.ItemStateChangedEvent] - Garaz_zew_L changed from 0 to 100
[ome.event.ItemCommandEvent] - Item ‘garaz_zew’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_S’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_P’ received command ON
[ome.event.ItemCommandEvent] - Item ‘Garaz_zew_L’ received command ON
edit openhab-webui/bundles/org.openhab.ui.habpanel/web/app/services/openhab.service.js and on line 168, change: .../rest/events?topics=smarthome/items/*/statechanged,...
to .../rest/events?topics=smarthome/items/*/state*,...(i.e. statechanged => state*)
This will make HABPanel react to “normally useless” ItemStateEvent (like it used to)
I have some news on this topic. I guess I found something - at least a workaround. The trick seems to be the AutoUpdatePolicy (Thanks to #1330 (comment)). When I add autoupdate="false" to the Group the events will be emitted probably:
This apperently presents a agreat workaround, thank you very much for spending the time to figure that out. I just wasted some hours wondering what was going on with my HABPanel groups, but thanks to you they now update again. Should be properly fixed, though
I confirm, it was working on OH 2.4, with 2.5 the workaround is to set autoupdate=false in the group item. I lost more than a couple of hours to get it!
Andrea
I am experiencing that problem where group switches are not updating.
I had presence detection with the network binding working for at least a month on 2.5.4. I noticed the detection had stopped working (don’t know if it coincided with implementing 2.5.5 because I didn’t check it at the time). I had also upgraded to 2.5.6, before I observed the problem with the group switch not updating.
I tried adding the autoupdate parameter described above, but it still doesn’t work.
I do also have the same problem running openHAB 2.5.9 on a raspberry 3. I think the autoupdate =“false” parameter is not the solution and I am not sure if the is a “offical” solution for the problem.
Did you try already workaroud described from @ysk already: