What do you mean by “one change”?
Obviously the item is changed multiple times when you use the slider (like sliding not tapping to another value)
Maybe have a look into the events log (/var/log/openhab2/events.log on ubuntu) and look (and show us) what exactly those events are?
@ChrisW this is a somewhat confusing effect at first, but each member of the group will update your group. So if you switch off all lamps you get 30 updates to your group status. I use the reentrant lock to prevent multiple triggers. If your rule moves too fast and is already done while your group is still updating, try adding a Thread::sleep(100) or so to wait, in this case 100millisecond, but be careful sleep should only be used for a short time.
For reentrant locks, use the right import and define a variable:
import java.util.concurrent.locks.ReentrantLock
var ReentrantLock lock = new ReentrantLock()
rule "Some Rule"
when
your_rule_trigger
then
var gotLock = lock.tryLock()
try {
if (gotLock) {
//do stuff
}
}
finally {
if(gotLock){
lock.unlock()
}
}
end
Just to step back a little bit it is important to realize how the state of a Group gets calculated. Every time one of the members of a Group changes it iterates through all of its members and recalculates its own state incrementally. Consequently, a Group will receive N-1 updates (where N is the number of members of the Group) for each single change to one of its members. Now as the Group incrementally updates its state, it is possible, depending on the aggregation function, that the Group’s state changes on each update.
Throw in the fact that you are using a slider and I’m not surprised you are seeing lots and lots of rule triggers.