import java.math.BigInteger // we need this for set/clearBit() rule "control pushbutton Items" // this rule converts on/off commands to buttons when Member of gAdamLights received command then // check if action needed first if((receivedCommand ==ON && triggeringItem.state != ON) || (receivedCommand == OFF && triggeringItem.state != OFF)) { val template = triggeringItem.name + "_pulse_" // find partner pushbutton in group, but we don't know suffix like _01 val button = gVlags.members.findFirst[i | i.name.contains(template)] if (button === null) { logWarn("ERROR", "config missing " + template) } else { button.sendCommand(ON) // push the button for change button.postUpdate(ON) // remember command // set up to un-push after 300mS createTimer(now.plusNanos(300000000)) [ | button.sendCommand(OFF) // un-push button // leave state ON and spawn new timer createTimer(now.plusSeconds(2)) [ | button.postUpdate(OFF) // forget the command ] ] } } // else no change needed end