Hi all,
I would like to understand how groups work. Thank you for looking at this.
I’m only one day in to use OpenHab, and have become stuck on getting Groups to work. I’ve read the User Manual, and find it a little less than clear, and not complete examples, just isolated parts. I’ve also read the latest 30 posts with the tag Groups, and have familiarised myself with some of the issues, but have not become any clearer on solutions.
By way of example, I would like to count the number of active devices connected and in doing so, try and get my understanding of groups > 0.
default.items
:
Group gAll
Group:Switch:OR(ON, OFF) gDevices "All Devices [%d]" (gAll)
Switch Presence_Phone "iPhone" <network> (gDevices) { channel="network:servicedevice:10_0_0_34_80:online" }
Switch Presence_Laptop "MacBook" <network> (gDevices) { channel="network:servicedevice:10_0_0_153_80:online" }
Number Connected_Devices "Connected devices [%d]" <network> (gDevices)
–
default.sitemap
:
sitemap default label="mySitemap"
{
Switch item=Presence_Phone label="iPhone" icon="switch"
Switch item=Presence_Laptop label="MacBook" icon="switch"
Text item=Connected_Devices label="Connected devices [%d]" icon="presence"
}
With one device connected, and one device disconnected, I would expect a value of ‘1’.
The way this is set up at the moment, I get only a dash “-” on the “Connected devices” item.
Edit: OH2.2.0, Smarthome 0.9.0, Rules Engine (Experimental) in Paper UI