This is very bad practice. Your are locking the thread these rules run in for a very long time
See:
To put your three rules into one:
var Number pHeat = null // AT TOP OF RULE FILE!!
rule "Front door CLOSED TO OPEN"
when
Item FrontDoorContact changed from CLOSED to OPEN
then
if(LocalSun_Position_Elevation.state < 0|°) { //Chekcs if the sun has gone down.
GangLys.sendCommand(ON)
}
createTimer(now.plusSeconds(45), [ |
if(KlingeTLF_Online.state == OFF && LottesTLF_Online.state == OFF) { //checks if anyones phone is currently online
sendNotification("my@mail.com", "Hovedøren er blevet åbnet!") //sends notificatioon that the door has been opend and noone is home
}
])
createTimer(now.plusSeconds(60) , [ |
pHeat = GangTermostat_SetpointHeat.state as Number //Stores the current temperature in a variable.
if(FrontDoorContact.state == OPEN) {
GangTermostat_SetpointHeat.sendCommand(8) //Sets temperature to 8 degrees
}
])
end
rule "Front Door OPEN TO CLOSED"
when
Item FrontDoorContact changed from OPEN to CLOSED
then
if (pHeat !==null) GangTermostat_SetpointHeat.sendCommand(pHeat)
pHeat = null //Resets pHeat for next time the door is opened
end