Is anyone else seeing this behavior:
The following group is empty when I iterate through it:
Group:Switch gWeather1LightsOFF
despite having members associated
when my rule wants to iterate through members of this group, it throws an error: cannot invoke method public java.util.Set org.eclipse.smarthome.core.items.GroupItem.getMembers() on null
(no other errors in log)
when I replace the number “1” with text “One” in the group name all works well;
this definition works:
Group:Switch gWeatherOneLightsOFF
The docs explicitly allow the use of numbers (together with letters and underscores)
Running on Ubuntu 16.04, all updated
2.3.0-SNAPSHOT
Build #1189
java: 1.8.0_151-b12
Here the rule (adapted from Rick’s Time of Day DP )
rule "WeatherOfDay changed"
when
Item WeatherOfDay received command
then
Thread::sleep(100) // give lastUpdate time to catch up
// Turn off previous Weather lights
val lastTod = PreviousWeatherOfDay.state.toString
val offGroupName = "g"+lastTod+"LightsOFF"
logInfo("Lights", "Light levels turning off " + offGroupName)
val GroupItem offGroup = gTimerLights.members.filter[ g |
g.name == offGroupName].head as GroupItem
offGroup.members.forEach[light |
logInfo("Lights", "Light levels turning OFF " + light.name)
light.sendCommand(OFF)
// Thread::sleep(100)
]
// Turn on current Weather lights
val onGroupName = "g"+receivedCommand+"LightsON"
logInfo("Lights", "Light levels turning on " + onGroupName)
val GroupItem onGroup = gTimerLights.members.filter[g |
g.name == onGroupName].head as GroupItem
onGroup.members.forEach[light |
logInfo("Lights", "Light levels turning ON " + light.name)
light.sendCommand(ON)
// Thread::sleep(100)
]
end
here one of the item definitions:
Switch Office_Lamp "Office Lamp" (gWeatherOneLightsON, gWeatherOneLightsOFF, gWeatherTwoLightsON, gWeatherTwoLightsOff, gLivingroom, gTPLink, gLightPanel,gMorningLightsON, gMorningLightsOFF, gEveningLightsON, gNightLightsOFF) {channel="tplinksmarthome:hs100:8F65C0:switch"}