How to check if an item is a member of a group?

It’s in my backlog, but planned to take a look at the new rules engine first. I’m not experiencing performance issues… but I do everything I can to get my motion sensor>light rules to fire as quickly as possible!

Unfortunately, I found an odd bug in getGroupNames that broke my rules! The names returned do not include groups where the item was added through GroupItem.addMember. I use this method to store light Items in a group that are in rooms where motion is active, so I can adjust lights when the lux changes. I’m still looking into it, but I’m pretty confident at this point that this is a bug and I’ll get it reported. Here is a simple test rule to illustrate:

rule "Test"
when
    Item Virtual_Switch_1 changed to ON
then
    gActive.removeMember(gDS_FamilyRoom_Bulb)
    logDebug("Rules", "test:gDS_FamilyRoom_Bulb.getGroupNames=[{}], gActive.members.contains(gDS_FamilyRoom_Bulb)=[{}]",gDS_FamilyRoom_Bulb.getGroupNames,gActive.members.contains(gDS_FamilyRoom_Bulb))
    gActive.addMember(gDS_FamilyRoom_Bulb)
    logDebug("Rules", "test:gDS_FamilyRoom_Bulb.getGroupNames=[{}], gActive.members.contains(gDS_FamilyRoom_Bulb)=[{}]",gDS_FamilyRoom_Bulb.getGroupNames,gActive.members.contains(gDS_FamilyRoom_Bulb))
    gActive.removeMember(gDS_FamilyRoom_Bulb)
    logDebug("Rules", "test:gDS_FamilyRoom_Bulb.getGroupNames=[{}], gActive.members.contains(gDS_FamilyRoom_Bulb)=[{}]",gDS_FamilyRoom_Bulb.getGroupNames,gActive.members.contains(gDS_FamilyRoom_Bulb))
end

OUTPUT

2017-12-08 17:05:02.188 [DEBUG] [org.eclipse.smarthome.model.script.Rules          ] - test:gDS_FamilyRoom_Bulb.getGroupNames=[[gLight, gDS_FamilyRoom]], gActive.members.contains(gDS_FamilyRoom_Bulb)=[false]
2017-12-08 17:05:02.189 [DEBUG] [org.eclipse.smarthome.model.script.Rules          ] - test:gDS_FamilyRoom_Bulb.getGroupNames=[[gLight, gDS_FamilyRoom]], gActive.members.contains(gDS_FamilyRoom_Bulb)=[true]
2017-12-08 17:05:02.190 [DEBUG] [org.eclipse.smarthome.model.script.Rules          ] - test:gDS_FamilyRoom_Bulb.getGroupNames=[[gLight, gDS_FamilyRoom]], gActive.members.contains(gDS_FamilyRoom_Bulb)=[false]