I’ve got a rule that picks out an Item based upon how long its been run for, and if its ON, I then want to check whether that Item is in another Group so I can apply a different set of conditions to it.
Is there an easy way to do this? Something like
if(MyItem IS IN THIS GROUP){
do something } else { do something different}
Google suggests that I have to iterate through the group, filtering as I go, whereas I want to work on a single item
Items File
Group:Number:AVG gChargerTimes
Group:Switch:AND(OFF,ON) gChargers
Group gSmallBattery
Switch Charger1 (gChargers,gSmallBattery)
Switch Charger2 (gChargers)
Switch Charger3 (gChargers,gSmallBattery)
Rules File
rule "when something happens check the charger powers"
gChargerTimes.members.sortBy[ -(state as Number) ].forEach[ NumberItem rT |
val offchargerName = rT.name.toString.split('Mins').get(1)
var offchargerItem = gInverterChargers.members.findFirst[ i | i.name == offchargerName ] as GenericItem
// in here I want to check if the item is a member of gSmallBattery and then process it differently
if (offchargerItem.state == ON && ChargeOFF > UsablePower.state as Number){
offchargeritem.sendCommand(OFF)
}
]
end