My group dies

I have three door sensors in a group called Doors. I have two rules that run when Item Doors changed.

It works once, from then on the Doors item never registers a change. I can make the same rules work fine if I list one door sensor by name. I can’t figure out why it stops working after only one time.

Any ideas?

`import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.model.script.actions.Timer //for the taking of input from the sitemap
import java.util.Date
import java.text.SimpleDateFormat
import org.joda.time.*
var Number Dusk = 18 //This is the hour after which lights should turn on when you walk in, 18 = 6:00 PM
var Number Dawn = 4 //This is when to stop turning on lights based on doors, not really dawn but after this time doors would only be for people leaving early so no need to turn lights on.

var autoOff = 1
//autoOff = (SirenWarningTime.state as DecimalType).intValue

//setup the siren
rule "Siren Configuration Initialization"
when
System started
then
postUpdate(SirenWarningTime, 5)
end

//sound the alarm after the wait period
rule "Alarm 2"
when
Item BackDoor changed
then
logInfo(“STDOUT”, “A door was just opened or closed.” )
if(DoorArmed.state == ON)
{
logInfo(“STDOUT”, “Door is armed, about to get the time delay from SirenWarningTime item.” )
autoOff = (SirenWarningTime.state as DecimalType).intValue
logInfo(“STDOUT”, “Siren time to wait " + autoOff + " seconds.” )
SirenTimer = createTimer(now.plusSeconds(autoOff)) [|
if(DoorArmed.state == ON){
logInfo(“STDOUT”, “The timer is up and the door is armed.” )
sendCommand(Siren, ON)
logInfo(“STDOUT”, “Clear the SirenTimer variable” )
SirenTimer = null}
else{
sendCommand(Siren, OFF)
logInfo(“STDOUT”, “Timer ran out but the door is no longer armed.” )}
]}
else{logInfo(“STDOUT”, “The alarm was not armed.” )}

end

rule "Alarm Off"
when
Item DoorArmed changed
then
if(DoorArmed.state == OFF){
sendCommand(Siren, OFF)}
end

//test any door changes option
rule "Doors have changed"
when
Item Doors changed
then
logInfo(“STDOUT”, “A door has in fact changed”)
end

//Vacation Mode Rules

rule "Not Home"
when
Time cron "0 33 21 * * ?"
then
if(VacationMode.state == ON){
sendCommand(LivingroomDimmer, 100)
logInfo( “file”, “Vacation mode, turning on the living room lights”)
}
else
logInfo( “file”, “Vacation mode not active”)
end

rule "Not Home 2"
when
Time cron "0 35 21 * * ?"
then
if(VacationMode.state == ON){
sendCommand(LivingroomDimmer, OFF)
logInfo( “file”, “Vacation mode, turning off the living room lights”)
}
else
logInfo( “file”, “Vacation mode not active”)
end

//end Vacation Mode Rules
//end new stuff
//end new stuff

/* This rule removed for troubleshooting
rule "MyTimeSTamp"
when
Item BackDoor changed
then
var SimpleDateFormat df = new SimpleDateFormat( “YYYY-MM-dd HH:mm:ss” )
var String Timestamp = df.format( new Date() )
logInfo( “File”, Timestamp )
end
*/

rule "Walk In Lights - Garage Door"
when
Item GarageDoor changed
then
if(GarageDoor.state == OPEN) {
logInfo( “file”, “door open, is it after dusk?”)
if(now.getHourOfDay >= Dusk) {
sendCommand(KitchenDimmer, ON);}
else {
logInfo( “file”, “door open, is it before dawn?”)
if(now.getHourOfDay <= Dawn){
sendCommand(KitchenDimmer, ON);}
}
}
end

rule "Walk In Lights - Front Door"
when
Item FrontDoor changed
then
if(FrontDoor.state == OPEN) {
logInfo( “file”, “door open, is it after dusk?”)
if(now.getHourOfDay >= Dusk) {
sendCommand(LivingroomDimmer, ON);}
else {
logInfo( “file”, “door open, is it before dawn?”)
if(now.getHourOfDay <= Dawn){
sendCommand(LivingroomDimmer, ON);}
}
}
end

/**This rule is for the alarm siren to go off when it is armed and the door is open
rule "Alarm"
when
Item BackDoor changed
then
if(DoorArmed.state == ON && BackDoor.state == OPEN)
sendCommand(Siren, ON)
if(BackDoor.state == CLOSED)
sendCommand(Siren, OFF)
end
*/

//2 rules to dim the boys lights at a given time

rule "Bedtime Reminder"
when
Time cron "0 45 21 * * ?"
then
sendCommand(Bedroom1Dimmer,60)
logInfo( “file”, “changing the lights based on the time”)
end
rule "Bedtime"
when
Time cron "0 5 22 * * ?"
then
sendCommand(Bedroom1Dimmer,OFF)
logInfo( “file”, “changing the lights based on the time”)
end

//Turn the boys lights on at a given time

rule "Wake up Routine"
when
Time cron "0 0 7 * * ?"
then
sendCommand(Bedroom1Dimmer,100)
logInfo( “file”, “changing the lights based on the time”)
end`

Could you say which rule doesnt work and maybe post the script formatted? Its quiet hard to read it that way

A group has its own state which is the aggregate of all the states of its members. By default it aggregates using OR. So if all doors are CLOSED and you open one door the group’s state changes to OPEN. But when you open a second door the group’s state is already OPEN so there is no change to trigger the rule.

The only way to do what you want is to list each door as a trigger to the rule or chang to received update as the trigger for the group. However, be aware tgat the group will receive multiple updates for each change to one of its members which will result in the rule triggering multiple times for each change.

Ah I see, I was just removing all my rules to just one test rule with the same problem, it only triggering once so I am grateful for your post!

I will try this instead:
when
Item BackDoor changed or
Item FrontDoor changed or
Item GarageDoor changed
then