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 = (i.name.toString.split("_").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 == (gOccupiedRooms.name.toString.split("_").get(0) + "_Temp").state] as NumberItem
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.