Groups seem to be broken

could you please have a look at my configurations? i dont get it running.

for excample i got a group of three hue lamps, all switches (all the same item-type, no dimmer!)

when i switch the lights on or off, the group item doesnt get a state-update. also the group-item doesnt have the state OFF, it has the state NULL - is that right?

Here is the response body from the rest api:

curl -X GET --header "Accept: application/json" "http://192.168.178.11:8080/rest/items/Group_Wohnzimmer_Licht"
{
  "members": [
    {
      "link": "http://192.168.178.11:8080/rest/items/HueLightstrip_SW",
      "state": "OFF",
      "type": "Switch",
      "name": "HueLightstrip_SW",
      "label": "HueLightstrip_SW",
      "category": "switch",
      "tags": [],
      "groupNames": [
        "Group_Wohnzimmer_Licht"
      ]
    },
    {
      "link": "http://192.168.178.11:8080/rest/items/HueStehlampeSofa_SW",
      "state": "OFF",
      "type": "Switch",
      "name": "HueStehlampeSofa_SW",
      "label": "HueStehlampeSofa_SW",
      "category": "switch",
      "tags": [],
      "groupNames": [
        "Group_Wohnzimmer_Licht"
      ]
    },
    {
      "link": "http://192.168.178.11:8080/rest/items/HueStehlampeTV_SW",
      "state": "OFF",
      "type": "Switch",
      "name": "HueStehlampeTV_SW",
      "label": "HueStehlampeTV_SW",
      "category": "switch",
      "tags": [],
      "groupNames": [
        "Group_Wohnzimmer_Licht"
      ]
    }
  ],
  "groupType": "Switch",
  "function": {
    "name": "OR",
    "params": [
      "OFF",
      "ON"
    ]
  },
  "link": "http://192.168.178.11:8080/rest/items/Group_Wohnzimmer_Licht",
  "state": "NULL",
  "type": "Group",
  "name": "Group_Wohnzimmer_Licht",
  "label": "Group_Wohnzimmer_Licht",
  "category": "Group",
  "tags": [],
  "groupNames": [
    "Group_Wohnzimmer"
  ]
}

would be great if you could help me solving this problem, because i use the group-state in varios habpanel-widgets.

Hi,

Today I did the Big Upgrade from version #838 to #946.
Everything went pretty smooth. But I noticed I have the same issue as described in this topic. :worried:

I have a pretty big set of rules which are triggered by a group item.
To be a bit more specific, the rule below is not triggered anymore:

rule "Raamcontacten consolideren"

when   
    Item gRaamcontact received update
then
	logInfo("test","Group update trigger works fine")
end

Based on the workaround described in this topic (https://github.com/eclipse/smarthome/issues/3622#issuecomment-307333582), I adapted my group items definition to:

Group:Switch					gRaamcontact				"Raamcontacten"						<window>				(gAlarm, gAllecontacten)

Since all items in the group are actually numbers, I also tried this:

Group:Number					gRaamcontact				"Raamcontacten"						<window>				(gAlarm, gAllecontacten)

Unfortunately, my rule does not kick in.
To exclude any other cause, I added the individual item(s) of that group in the rule-trigger section. And then the rule is triggered correctly…

So any help would be appreciated. This change has broken 60% of my rules… :frowning:

I was also trying to add a function (SUM, MAX). And I noticed that the group status isn’t calculated correctly.

Item:

Group:Number:MAX					gRaamcontact				"Raamcontacten"						<window>				(gAlarm, gAllecontacten)

REST API response on gRaamcontact:
(notice that the last item has state “1” but the MAX of the group is still “0”.

    {
      "link": "http://192.168.3.2:8080/rest/items/Tex_Zone_Z036_W10_2",
      "state": "1",
      "transformedState": "Open",
      "stateDescription": {
        "pattern": "",
        "readOnly": false,
        "options": []
      },
      "type": "Number",
      "name": "Tex_Zone_Z036_W10_2",
      "label": "Z36 - Raam bureau zijkant kipstand",
      "category": "window",
      "tags": [],
      "groupNames": [
        "gGV_Bureau",
        "gRaamcontact"
      ]
    }
  ],
  "groupType": "Number",
  "function": {
    "name": "MAX"
  },
  "link": "http://192.168.3.2:8080/rest/items/gRaamcontact",
  "state": "0",
  "type": "Group",
  "name": "gRaamcontact",
  "label": "Raamcontacten",
  "category": "window",
  "tags": [],
  "groupNames": [
    "gAlarm",
    "gAllecontacten"
  ]
}

EDIT: Solved! I guess when you tamper with the group-functions a restart of OpenHAB is not a bad thing. Restarting solved my problem. I have defined all my groups now as “Group:Number:SUM”

@e36Alex Did you try a restart of openHAB? As this workaround seems to do its job for everyone else, I’d hope you get it working as well :slight_smile:

In general, I would consider the “workaround” even as the official fix, because the change that has been done in the framework really fixes quite some issues and make the architecture much cleaner. So I would suggest to keep things as they are and I will add a clear warning/advice in the upcoming 2.1 release notes that such item definitions need to be updated accordingly.

1 Like

@Kai:
Actually i found a way to get the result i wanted. but the options are not working smoothely in my opion.

here an example:
I have an group of three hue bulps. in the group are just the switches.

So in my opinion the state of the group should be the same in both of the opions with the following switch-states, but it isnt.:

Bulp 1: ON
Bulp 2: OFF
Bulp 3: OFF

ALL OFF --> OFF else ON --> Result: Group state is OFF
ONE ON --> ON else OFF --> Result: Group state is ON

I choose the second option now but i am not understandig the difference.

Also i got another issue during changing the options in the group, have a look at this:

Congrats, you have just found a bug in the Paper UI :wink:
I have entered an issue for it: https://github.com/eclipse/smarthome/issues/3684

@Kai: Great, i found a bug! Do you think i can exchange it for a solotion here?

No, that is only when you solve a bug. :wink:

oh, i almost expected something like this :smiley:

I suppose I’m pretty late to the party but I just upgraded today to 2.1.0-1 and ran into this issue.
My most important rules (used to) work by examining a Group switch status and then querying the Group to see which member last updated it. If a Group is already “ON”, a subsequent “ON” doesn’t update the last member that went “ON”.
What’s the alternative? Check every single switch to see if it changed??

Thanks but I have already read all this and it doesn’t solve my problem. I have already added the Type to my groups to get them to receive updates.
Previously if a Group was updated for example from OFF to ON I could find out which member made that change and that was great. If a subsequent member of the Group also updated from OFF to ON, the Group state didn’t change but a query on the Group returned the second member.
Now, in the above scenario, a query to the Group always returns the first member that did the update.
Since I have read that the issue is closed, I guess I’ll have to rethink my rules.
Thanks.

Maybe some details of this query?

Sure. The rule itself is long but I’ll post the portion I’m having trouble with:

rule "handle_ui_light_switch"
when
   Item All_Lights_switches received update
then
   logDebug("LIGHTS", "Rule: UI Light Switch:Starting")
   Thread::sleep(300)
   val ChangedSwitch = All_Lights_switches?.members.sortBy[lastUpdate].last as SwitchItem
   logDebug("LIGHTS", "Rule: UI Light Switch ChangedSwitch: " + ChangedSwitch)

Although this rule gets called every time a light switch is activated, the “ChangedSwitch” var is always the same with the latest update of the Group functionality.

Okay, you are not the only one with lastUpdate troubles

Nobody has pinned down what is going wrong yet, perhaps you could set up a test case with a couple of Items and compare their individual lastUpdate with the group version

EDIT - thinks; do you get the same behaviour with .allMembers (instead of .members)?

Thanks for your answer.
The issues could be related although I’m not getting the

cannot be resolved to an item or type

error message. My rule is working without errors but just not getting what I expect.
I will definitely set up a test case or two to see how I can work around this issue and will post what I can figure out. I’ll also test the .allMembers function you suggested.
Thanks.

I created this test case which does nothing except report the lastupdate member:

rule "Test_All_Lights_switches"
when
   Item All_Lights_switches received update
then
   logDebug("LUMENCACHE", "Rule: UI Light Test Switch:Starting")
   Thread::sleep(300)
   val ChangedSwitch = All_Lights_switches?.allMembers.sortBy[lastUpdate].last as SwitchItem
   logDebug("LUMENCACHE", "Rule: UI Light Test Switch ChangedSwitch: " + ChangedSwitch)
end

No matter which light switch I toggle or what state it is transitioned to (ON or OFF) in the basicUI or HABpanel, the log reports:

2017-07-09 10:51:00.154 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
2017-07-09 10:51:01.635 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch ChangedSwitch: Light_Master_bedroom_switch (Type=SwitchItem, State=OFF, Label=Master Bedroom, Category=null, Groups=[gSF, All_Lights_switches])
2017-07-09 10:51:06.627 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
2017-07-09 10:51:06.982 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch ChangedSwitch: Light_Master_bedroom_switch (Type=SwitchItem, State=OFF, Label=Master Bedroom, Category=null, Groups=[gSF, All_Lights_switches])
2017-07-09 10:51:11.770 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
2017-07-09 10:51:12.135 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch ChangedSwitch: Light_Master_bedroom_switch (Type=SwitchItem, State=OFF, Label=Master Bedroom, Category=null, Groups=[gSF, All_Lights_switches])

As you can see, I performed the test also with allMembers but the behavior is the same.
Perhaps this is somehow related to persistence? I’ll try to look into that.

I think you should display the actual item.lastUpdate value, of the filtered-from-group item, and the one that you are expecting to change. Guessing there are no changes i.e. persistence not working.

Looks like persistence broke with my latest OH2 update. I have mapdb setup for All_Lights_switches but when using
All_Lights_switches?.allMembers.sortBy[lastUpdate("mapdb")].last as SwitchItem
All I get for my last switch member name is: null

My MapDB config has:
All_Lights_switches* : strategy = everyChange, everyDay, restoreOnStartup

I was always using lastUpdate with no specified persistence since I had rrd4j set as the default and just changed it now in my tests to “mapdb” to see if that would resolve my problem.
So although the persistence DB files for both rrd4j and mapdb have updated timestamps, it would seem that they are not getting updated automatically. I tried reinstalling both persistence methods through paperui and restarted OH2 but that made no difference.
Kind of wishing I didn’t perform this OH2 update…

Sounds so similar to this error

where only Group was persisted due to finger trouble - but you do appear to have the necessary *. Sure you have all stratagies defined OK?

Yes, I read that post too. I quoted the line directly from my config and it did work just fine before I performed the OH2 update. Since I can’t figure out why lastUpdate isn’t working for me anymore or why my persistence isn’t getting updated, it seems like I’m going to have to add an item to every switch to create my own persistence.
When the Group triggers the rule, I’ll have to loop through all my switches and compare current state to my saved switch persistence items. It’ll be crude, but besides doing a scratch installation to see if my problems magically disappear I don’t see I have much choice.
Btw, thanks very much for your support.