Group switch not updating

Either would be great, but the problem here seems to be that you don’t get any “changed” (ItemStateChangedEvent or GroupItemStateChangedEvent) events on the group item when you send a command to it (even if it caused its children to change their state).

My example logs from above show the Group gLights_ALL changing in response to a command and it did receive a GroupItemStateChangedEvent in that case when one of it’s members changed. It’s not clear to me why it works for me but not OP.

I should add: I won’t mind HABPanel processing ItemStateEvent again if it helps, but the purpose of https://github.com/openhab/openhab-webui/pull/128 was to avoid having to process those events which in many cases merely “confirm” the current state of an item - it’s a performance hit, causes CPU usage, battery drains etc; for instance, I have several items whose states are set by the HTTP1 binding every few seconds, which means many ItemStateEvents are sent every second even though the state hasn’t changed, those aren’t really useful to process.

This seems … unlikely. Whether you send a command to a group or do something to a member, it will not change the group state directly. Later, if a member updates in response to that command or some other action, then the group will update (and should make an event).
The group has no way to know why that update was triggered, what the original action was.

IIRC the GroupItemStateChangedEvent will be sent if the state of a group item changes through one of its members.

In case we want to trigger an event it should be an ItemStateChangedEvent. Currently the implementation of the GroupItem suppresses the emitment of an event. The setState(State) method overrides the default behavior of an item. According to the JavaDoc on setState(State) in GenericItem this implementation is wrong. Changing the code is not a big deal. Shall I propose a change?

See code in GenericItem and GroupItem.

1 Like

Thanks @cweitkamp for investigating!

I’d say generally speaking, every state change should be reflected in a ItemStateChangeEvent, so I’m in favor of this! :slight_smile:

What I still don’t understand, if we look back at @sovapatr’s example above, when the GRP_KTN_Lights group is switched to ON, we see its members receive the ON command, as expected, and since it causes their state to change, which in turn causes the group’s state to be changed, shouldn’t GroupItemStateChangedEvents be emitted as well?

A command could lead to a change of the state. The group proxies the commands to its members. I do not know the flow in detail but I could imagin that the state of the group has been changed by the command before one of the members state changed …

It shouldn’t. Group state should reflect the aggregation function over it’s members.
(Obviously in real life a Group command may ultimately cause member updates, in turn causing Group update - but it’s not guaranteed)

I suppose it’s arguable. Group states change indirectly (function of members) which is what GroupItemStateChangedEvent reprsents I suppose.
The question becomes is ItemStateChangeEvent supposed to indicate only direct updates, or indirect ones too?
If all updates, what s the purpose of the GroupItemStateChangedEvent - it adds no new knowledge.
Perhaps it is redundant - these decisions were made a long time ago.

That’s what I meant above, apparently even in this case no events (apart from a ItemStateEvent) seem to be emitted on the group, which is abnormal IMHO.

Indeed. That was the root of OP’s post. The odd thing though is it doesn’t seem to be universal. For example, I am getting the events on my Group when it’s members change in response to a command to the Group. See the logs in post 6.

I tried on a fresh 2.5 install with the demo items and here are the results:

openhab> smarthome:items list Heating*
Heating_GF_Corridor (Type=SwitchItem, State=OFF, Label=Corridor, Category=heating, Tags=[HVAC], Groups=[GF_Corridor, Heating])
Heating (Type=GroupItem, BaseType=SwitchItem, Members=9, State=OFF, Label=No. of Active Heatings, Category=heating)
Heating_FF_Bath (Type=SwitchItem, State=OFF, Label=Bath, Category=heating, Tags=[HVAC], Groups=[FF_Bath, Heating])
Heating_FF_Bed (Type=SwitchItem, State=OFF, Label=Bedroom, Category=heating, Tags=[HVAC], Groups=[FF_Bed, Heating])
Heating_FF_Daughter (Type=SwitchItem, State=OFF, Label=Amelia's Room, Category=heating, Tags=[HVAC], Groups=[FF_Daughter, Heating])
Heating_FF_Office (Type=SwitchItem, State=OFF, Label=Office, Category=heating, Tags=[HVAC], Groups=[FF_Office, Heating])
Heating_GF_Toilet (Type=SwitchItem, State=OFF, Label=Toilet, Category=heating, Tags=[HVAC], Groups=[GF_Toilet, Heating])
Heating_FF_Son (Type=SwitchItem, State=OFF, Label=Oliver's Room, Category=heating, Tags=[HVAC], Groups=[FF_Son, Heating])
Heating_GF_Living (Type=SwitchItem, State=OFF, Label=Livingroom, Category=heating, Tags=[HVAC], Groups=[GF_Living, Heating])
Heating_GF_Kitchen (Type=SwitchItem, State=OFF, Label=Kitchen, Category=heating, Tags=[HVAC], Groups=[GF_Kitchen, Heating])
openhab> smarthome:send Heating ON
Command has been sent successfully.
openhab> log:display -n 25
...
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating' received command ON
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Corridor' received command ON
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Toilet' received command ON
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Living' received command ON
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Kitchen' received command ON
17:36:20.527 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bath' received command ON
17:36:20.528 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Office' received command ON
17:36:20.528 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Son' received command ON
17:36:20.528 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Daughter' received command ON
17:36:20.528 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bed' received command ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Corridor changed from OFF to ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Toilet changed from OFF to ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Living changed from OFF to ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Kitchen changed from OFF to ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bath changed from OFF to ON
17:36:20.531 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Office changed from OFF to ON
17:36:20.532 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Son changed from OFF to ON
17:36:20.532 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Daughter changed from OFF to ON
17:36:20.532 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bed changed from OFF to ON





openhab> smarthome:items list Heating*
Heating_GF_Corridor (Type=SwitchItem, State=ON, Label=Corridor, Category=heating, Tags=[HVAC], Groups=[GF_Corridor, Heating])
Heating (Type=GroupItem, BaseType=SwitchItem, Members=9, State=ON, Label=No. of Active Heatings, Category=heating)
Heating_FF_Bath (Type=SwitchItem, State=ON, Label=Bath, Category=heating, Tags=[HVAC], Groups=[FF_Bath, Heating])
Heating_FF_Bed (Type=SwitchItem, State=ON, Label=Bedroom, Category=heating, Tags=[HVAC], Groups=[FF_Bed, Heating])
Heating_FF_Daughter (Type=SwitchItem, State=ON, Label=Amelia's Room, Category=heating, Tags=[HVAC], Groups=[FF_Daughter, Heating])
Heating_FF_Office (Type=SwitchItem, State=ON, Label=Office, Category=heating, Tags=[HVAC], Groups=[FF_Office, Heating])
Heating_GF_Toilet (Type=SwitchItem, State=ON, Label=Toilet, Category=heating, Tags=[HVAC], Groups=[GF_Toilet, Heating])
Heating_FF_Son (Type=SwitchItem, State=ON, Label=Oliver's Room, Category=heating, Tags=[HVAC], Groups=[FF_Son, Heating])
Heating_GF_Living (Type=SwitchItem, State=ON, Label=Livingroom, Category=heating, Tags=[HVAC], Groups=[GF_Living, Heating])
Heating_GF_Kitchen (Type=SwitchItem, State=ON, Label=Kitchen, Category=heating, Tags=[HVAC], Groups=[GF_Kitchen, Heating])
openhab> smarthome:send Heating OFF
Command has been sent successfully.
openhab> log:display -n 25
...
17:38:13.411 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating' received command OFF
17:38:13.411 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Corridor' received command OFF
17:38:13.411 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Toilet' received command OFF
17:38:13.411 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Living' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Kitchen' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bath' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Office' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Son' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Daughter' received command OFF
17:38:13.412 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bed' received command OFF
17:38:13.414 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Corridor changed from ON to OFF
17:38:13.414 [INFO ] [home.event.GroupItemStateChangedEvent] - Heating changed from OFF to ON through Heating_GF_Corridor
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Toilet changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Living changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Kitchen changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bath changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Office changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Son changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Daughter changed from ON to OFF
17:38:13.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bed changed from ON to OFF
17:38:13.415 [INFO ] [home.event.GroupItemStateChangedEvent] - Heating changed from ON to OFF through Heating_GF_Living





openhab> smarthome:items list Heating*
Heating_GF_Corridor (Type=SwitchItem, State=OFF, Label=Corridor, Category=heating, Tags=[HVAC], Groups=[GF_Corridor, Heating])
Heating (Type=GroupItem, BaseType=SwitchItem, Members=9, State=OFF, Label=No. of Active Heatings, Category=heating)
Heating_FF_Bath (Type=SwitchItem, State=OFF, Label=Bath, Category=heating, Tags=[HVAC], Groups=[FF_Bath, Heating])
Heating_FF_Bed (Type=SwitchItem, State=OFF, Label=Bedroom, Category=heating, Tags=[HVAC], Groups=[FF_Bed, Heating])
Heating_FF_Daughter (Type=SwitchItem, State=OFF, Label=Amelia's Room, Category=heating, Tags=[HVAC], Groups=[FF_Daughter, Heating])
Heating_FF_Office (Type=SwitchItem, State=OFF, Label=Office, Category=heating, Tags=[HVAC], Groups=[FF_Office, Heating])
Heating_GF_Toilet (Type=SwitchItem, State=OFF, Label=Toilet, Category=heating, Tags=[HVAC], Groups=[GF_Toilet, Heating])
Heating_FF_Son (Type=SwitchItem, State=OFF, Label=Oliver's Room, Category=heating, Tags=[HVAC], Groups=[FF_Son, Heating])
Heating_GF_Living (Type=SwitchItem, State=OFF, Label=Livingroom, Category=heating, Tags=[HVAC], Groups=[GF_Living, Heating])
Heating_GF_Kitchen (Type=SwitchItem, State=OFF, Label=Kitchen, Category=heating, Tags=[HVAC], Groups=[GF_Kitchen, Heating])
openhab> smarthome:send Heating ON
Command has been sent successfully.
openhab> log:display -n 25
...
17:38:50.030 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating' received command ON
17:38:50.030 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Corridor' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Toilet' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Living' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_GF_Kitchen' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bath' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Office' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Son' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Daughter' received command ON
17:38:50.031 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Heating_FF_Bed' received command ON
17:38:50.032 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Corridor changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Toilet changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Living changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_GF_Kitchen changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bath changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Office changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Son changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Daughter changed from OFF to ON
17:38:50.036 [INFO ] [smarthome.event.ItemStateChangedEvent] - Heating_FF_Bed changed from OFF to ON

I list the items, send the “opposite” command to the group, and check the logs, three times.

  • The first time, I don’t get any event related to the group state.

  • The second time, there’s a:

    17:38:13.414 [INFO ] [home.event.GroupItemStateChangedEvent] - Heating changed from OFF to ON through Heating_GF_Corridor

almost immediately followed by:

17:38:13.415 [INFO ] [home.event.GroupItemStateChangedEvent] - Heating changed from ON to OFF through Heating_GF_Living

i.e. what @rlkoshak had too: the first one makes no sense, the group’s state was ON at this point and an OFF command was just sent. Thinking about it, could it be the missing GroupItemChangedEvent which was supposed to be sent as a result of the first command?

  • The third time, again there’s no GroupItemStateChangedEvent.

The only pattern I can identify in all the examples in this thread is that when an ON command is sent, no events are emitted, but when an OFF command is sent, 2 of them (including 1 wrong one) are emitted.

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.

You might be onto something.

Fun fact, there seems to be some test cases for this scenario here:

That is correct.

@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:

Group:Switch:OR(ON,OFF) gTESTSWITCHES1 "Test Switches 1"
Switch testSwitch1 "Test Switch 1" (gTESTSWITCHES1)

Initial situation: state of Switch and Group are both ON.

1st try: Sending OFF to Switch:

openhab> smarthome:send testSwitch1 OFF
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/gTESTSWITCHES1/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"GroupItemStateChangedEvent"}

:+1: working

2nd try: Sending ON to Switch:

openhab> smarthome:send testSwitch1 ON
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/gTESTSWITCHES1/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"GroupItemStateChangedEvent"}

:+1: again working

3rd try: Sending OFF to Group:

openhab> smarthome:send gTESTSWITCHES1 OFF
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}

:interrobang: Outch, failing - GroupItemStateChangedEvent is missing.

4th try: Sending ON to Group:

openhab> smarthome:send gTESTSWITCHES1 ON
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

:interrobang: 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.

Summary
Group:Switch:OR(ON,OFF) gTESTSWITCHES2 "Test Switches 2"
Switch testSwitch1 "Test Switch 1" (gTESTSWITCHES2)
Switch testSwitch2 "Test Switch 2" (gTESTSWITCHES2)

Initial situation: state of both Switches and Group are ON.

1st try: Sending OFF to Switch 1 and Switch 2:

openhab> smarthome:send testSwitch1 OFF
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}
openhab> smarthome:send testSwitch2 OFF
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/gTESTSWITCHES2/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"GroupItemStateChangedEvent"}

:+1: working

2nd try: Sending ON to Switch 1 and Switch 2:

openhab> smarthome:send testSwitch1 ON
Command has been sent successfully.
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/gTESTSWITCHES2/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"GroupItemStateChangedEvent"}
openhab> smarthome:send testSwitch2 ON
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

:+1: working

3rd try: Sending OFF to Group:

openhab> smarthome:send gTESTSWITCHES2 OFF
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/gTESTSWITCHES2/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"GroupItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/gTESTSWITCHES2/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"GroupItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\",\"oldType\":\"OnOff\",\"oldValue\":\"ON\"}","type":"ItemStateChangedEvent"}

:interrobang: Outch - two GroupItemStateChangedEvents, one seem to be absolutely wrong - conurrency issue???

4th try: Sending ON to Group:

openhab> smarthome:send gTESTSWITCHES2 ON
Command has been sent successfully.
event: message
data: {"topic":"smarthome/items/testSwitch1/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

event: message
data: {"topic":"smarthome/items/testSwitch2/statechanged","payload":"{\"type\":\"OnOff\",\"value\":\"ON\",\"oldType\":\"OnOff\",\"oldValue\":\"OFF\"}","type":"ItemStateChangedEvent"}

:interrobang: Outch - no GroupItemStateChangedEvent at all

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.

4 Likes

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!

Hi,

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!

Hi,

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 :grinning:
Habpanel item status not changed - fail :worried:

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 :worried:
Habpanel item status not changed - fail :worried:

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

For non group items all works fine.

Any solution or workaround?

Related reported issue can be found here on openhab/openhab-core:
Group switch update in HABPanel doesn’t work correct

1 Like