Is it possible to have a global rule for different items and have only the item that triggered the rule to have the command send? For exemple, itemx changed:
itemx changed from on to off or
itemy changed from on to off or
itemz changed from on to of
rule "group loop"
when
Item myGroupOfItems changed from on to off
then
myGroupOfItems?.members.forEach[item|
if (item.state == ON) {
item.sendCommand(something)
}
}
end
Not directly but you can cheat if you put all your items in a group and grab the one most recently updated. This only works if you have persistence configured and working.
Thread::sleep(100) // give persistence time to same the change, experiment with different times
myGroupOfItems.members.sortBy[lastUpdate].last.sendCommand(newState)
I tried your rule but it doesn’t work.
I have persistence for the items db4o.
Is it possiblle to have an exemple with logging the item that was
identified?
You have to give us more to work with than “it didn’t work”. What was the error. Post exactly what your Items and rule looks like. Post and log statements that site the error.
I know my code works. I copied and pasted it from one of my working rules.