How to make Widget aware of group state change

Hi,
I have searched and googled alot, but could not find an answer to my issue.
I recently started to fiddle with habPanel so please bear with me, in case this is a beginner’s question.

I have the following situation.
I have several contact items (windows), which I want to group, to have a general indication that in a certain room (e.g. livingroom) all windows are closed. I have setup a group item in openHAB and have added my contact items to said group.
The group is setup with a function so that a single non “CLOSED” window contact will put the whole group in state OPEN.

This all seems to work fine. When opening one of the windows, I can see that in openHAB event log the corresponding contact item changing it’s state, as well as the group.

I have now two widgets in habpanel, one containing all the contacts directly, and one that contains just the group. The problem is, that upon state change of a contact, only the widget with the discreet states is updated. The widget showing the group is not updated, and will only show the current state after a manual refresh.

I checked via Chromes debug tools, that the event stream reaching habpanel is containing both events.
Am I missing something obvious here, or should I start gathering logs, etc… ?

I’ve done the same thing for my doors, the easiest way is to make a switch item in OpenHAB and write a rule that will loop through the items in your group on update and set the state of the switch item

supposing your group is called “Door”

In Item file use:
Group:Contact:OR(OPEN,CLOSED) Door instead of just Group Door
No need of any rule

In HABPanel if you want also to see the number of open doors use in a template
{{(itemsInGroup(‘Door’) | filter:{state:‘OPEN’}).length}} - {{itemValue(‘Door’)}}

1 Like

Thank you both for your suggestions. However, as stated it is not a matter of getting the groups working in openHab. The group indeed is working and following the state changes of it’s members.

My group definition:

Group:Contact:AND(CLOSED,OPEN) GrpWohnzimmerFenster "Wohnzimmer Fenster [%s]"

and here’s also a log excerpt when I flip one of the contacts:

2017-02-16 22:18:09.024 [GroupItemStateChangedEvent] - GrpWohnzimmerFenster changed from CLOSED to OPEN through Fenster1_1_State
2017-02-16 22:18:09.026 [ItemStateChangedEvent ] - Fenster1_1_State changed from CLOSED to OPEN

As stated before, even on the client side (i.e. habPanel in browser) I can see those changes being published in the eventstream:

message	{"topic":"smarthome/items/Fenster1_1_State/state","payload":"{\"type\":\"OpenClosedType\",\"value\":\"OPEN\"}","type":"ItemStateEvent"}	    22:19:39.079
message	{"topic":"smarthome/items/Fenster1_1_State/statechanged","payload":"{\"type\":\"OpenClosedType\",\"value\":\"OPEN\",\"oldType\":\"OpenClosedType\",\"oldValue\":\"CLOSED\"}","type":"ItemStateChangedEvent"}	    22:19:39.135
message	{"topic":"smarthome/items/GrpWohnzimmerFenster/Fenster1_1_State/statechanged","payload":"{\"type\":\"OpenClosedType\",\"value\":\"OPEN\",\"oldType\":\"OpenClosedType\",\"oldValue\":\"CLOSED\"}","type":"GroupItemStateChangedEvent"}	    22:19:39.136

However, the widget that is configured to show the group does not update when these events arrived, but to my understanding it should updated based on the third message shown in the eventstream excerpt.

Maybe this is about the way I access the group? I have simply used

{{itemValue('GrpWohnzimmerFenster')}}

in a Template type widget.

This should be fixed as of this commit (dated January 27th):

Maybe you have the version that shipped with openHAB 2.0 which doesn’t include this change.

1 Like

Spot on @ysc!
I updated to the latest nightly and the widget for the group now behaves as expected.
Thanks for pointing out that fix.

Hi,

Every time I switch between the HABPanel dashboards, the values ​​are lost and only NULL is shown.
There is no ChangeEvent in the event logfile. [Update:] Only occurs with IE

Group:

Group:Contact:OR(OPEN, CLOSED) gFenster “Alle Fenster”

Has anybody an idea why?