Getting the value of related items using a group

Trying a different method to do multiuser room presence.
Essentially room presence detected by ble (or manually switched)
Room presence is turned on/off by rules on groups which work
I can create a group with the rooms that are on
I can create a group with the numbers of people in the room
What I’m struggling with is how to take the rooms that are occupied take their temperatures and produce the lowest value. I had hoped I could do it via groups…but maybe just need write lots of if statements. Ive commented out the 1 that doesn’t work

rule "change room with ble presence"

    Member of gRoomPresence changed
     if (Heating_Type.state == "Home")

        val Number kitchenpresencecount=(gRoomPresence?.members.filter[i|i.state.toString == "kitchen"].size)
        val Number livingroompresencecount=(gRoomPresence?.members.filter[i|i.state.toString == "livingroom"].size)
        val Number firstfloorpresencecount=(gRoomPresence?.members.filter[i|i.state.toString == "firstfloor"].size)
        val Number offpresencecount=(gRoomPresence?.members.filter[i|i.state.toString == "off"].size)
        val place=(triggeringItem.state.toString + "_PresenceSwitch")
        gPresenceCount.members.filter[i | (i.state as Number == 0)].forEach[i | var String p = ("_").get(0) + "_PresenceSwitch") sendCommand(p,"OFF")]
        gOccupiedRooms.members.forEach[i | gOccupiedRooms.removeMember(i)]
        gPresenceSwitch.members.filter[s | s.state == ON].forEach[i | gOccupiedRooms.addMember(i)]
//        val MinTemp = gOccupiedRooms.members.findFirst[p | p.state == ("_").get(0) + "_Temp").state] as NumberItem

I didn’t really follow what problem you are having from the text or example; but going from the posting title, this may help -

Before that was available, we used to search in a Group for members with name=whateverstringwemade

Apologies for not being clear
Theory is using BLE devices and room assistant to trigger heating zones.
When the zone is changed the rule fires and turns on that zone
Then checks to see if anyone else in that zone - if not turns it off. Heating values are adjusted to reduce heating in that area.
If there is only 1 person in the house, then checking to see if the correct temperature has been reached is easy. But what if more than 1 zone is active?
It’s getting the temperature associated with the active zone that is proving difficult.
My thoughts have been mainly adding the active zones to a group then taking the values from each zone (using prefix of the zone + suffix for the temp) and then sorting them through a group.

This worked! Thank you.
Was simply the string wasn’t an item so couldn’t be added. Using this it has added the temperature item to the group

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.