I’m running OH2B5 and when editing some rules over time they stop working.
Right after editing/saving a rule the logs show this:
2017-01-13 00:23:31.333 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model '04-doorsensors_dimmers.rules'
2017-01-13 00:23:36.521 [INFO ] [org.quartz.core.QuartzScheduler ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.
When this message appears “openHAB-job-scheduler_$_NON_CLUSTERED” the rules stop working. Even if i edit other .rules files:
2017-01-13 00:25:55.358 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model '00-general.rules'
2017-01-13 00:26:02.316 [INFO ] [org.quartz.core.QuartzScheduler ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.
The only way to fix this so the rules start working again is to restart OH2. I do notice that when that message appears a OH2 restart takes A LOT longer than normal.
Below is my 04-doorsensors_dimmers.rules file if this is of any assistance.
import org.joda.time.*
import org.openhab.core.types.*
import org.openhab.core.library.types.*
import org.openhab.core.library.items.*
import org.openhab.core.items.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.eclipse.xtext.xbase.lib.*
//-----------------------------door sensor vars--
//Global variable used for lights on delay. How long to keep lights on after door opens?
var Integer timeout = 150 //seconds
//Timers for Door Sensors.
var Timer tHouseDoor = null
var Timer tPatioDoor1 = null
var Timer tGarageDoor1 = null
//******************************************************
//-----------------------------dimmer vars--
var int percent = 0
//***************************************************************************************
//* *
//* D I M M E R S Y N C R U L E S *
//* *
//***************************************************************************************
/* Office Dimmer Disable Syncing when Lights turned OFF */
rule "Soffit Dimmer: Disable Sync when OFF"
when
Item Light_House_Soffit changed to 0
then
postUpdate(dimmerSync,0)
logInfo("RULE.LIGHTING.dimmerSync", "--> Dimmer Turned OFF. Clearing Sycing (dimmerSync = 0)")
end
//***************************************************************************************
/* Office Dimmer SCENE Control -- Dimmer Syncing */
/* 0 = OFF, 2 = House & Garage , 3 = ALL */
rule "House Soffit Side Dimmer: Sync based on SCENE"
when
Item Light_House_Soffit received update
then
percent = ((Light_House_Soffit.state as DecimalType)).intValue
if(percent!= 0){
postUpdate(Light_House_Soffit_LastValue, percent)
logInfo("RULE.LIGHTING.Light_House_Soffit", "--> Updating Last Dimmer Value to {}%", percent)
}
switch(dimmerSync.state) {
case 0 : {
/* Single Press - No action for local light control*/
logInfo("RULE.LIGHTING.Light_House_Soffit", "--> dimmerSync = 0.")
}
case 2 : {
// WHen dimmerSync = 2. Send same dimness value to garage soffit dimmer.
sendCommand(Light_Garage_Soffit, percent)
logInfo("RULE.LIGHTING.Light_House_Soffit", "--> dimmerSync = 2. Syncing House and Garage")
}
case 3 : {
logInfo("RULE.LIGHTING.Light_House_Soffit", "--> dimmerSync = 3.")
}
}
end
//***************************************************************************************
/* House Side Dimmer SCENE Control -- Scene Tap Selection Syncing */
/* 0 = OFF, 2 = House & Garage , 3 = ALL */
rule "House Soffit Side Dimmer: Scene Tap Selection Syncing"
when
Item Light_House_Soffit_Scene received update
then
switch(Light_House_Soffit_Scene.state) {
/*ON*/
case 1.0 : { /* Single Tap ON */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Single Press ON")
if (tHouseDoor !=null) {
tHouseDoor.cancel()
logInfo("RULE.LIGHTING.Light_House_Soffit", "Canceling Door Open OFF Timer. Single Press Up Received")
tHouseDoor= null
}
}
case 1.3 : { /* Double Tap ON */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Double Press ON")
postUpdate(dimmerSync,2)
if(Light_House_Soffit.state == 0){
sendCommand(Light_House_Soffit, ON)
sendCommand(Light_Garage_Soffit, ON)
}
else {
percent = ((Light_House_Soffit.state as DecimalType)).intValue
sendCommand(Light_Garage_Soffit, percent)
}
}
case 1.4 : { /* Tripple Tap ON */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Tripple Press ON")
postUpdate(dimmerSync,3)
}
/*OFF*/
case 2.0 : { /* Single Tap OFF */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Single Press OFF")
}
case 2.3 : { /* Double Tap OFF */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Double Press OFF")
postUpdate(dimmerSync,0)
sendCommand(Light_Garage_Soffit, OFF)
sendCommand(Light_House_Soffit, OFF)
}
case 2.4 : { /* Tripple Tap OFF */
logInfo("RULE.LIGHTING.Light_House_Soffit", "Tripple Press OFF")
postUpdate(dimmerSync,0)
}
}
end
rule "Turn Lights off if not DARK"
when
Item gLightsOFFifDAYLIGHT changed
then
if(NightState.state != ON && AllowLightsDaylight.state != ON) {
gLightsOFFifDAYLIGHT.allMembers.filter(s | s.state > 0 ).forEach[ item |
logInfo("RULE.LIGHTING.OFFwhenBRIGHT", "--> Light ON during Daylight. Turning OFF [{}]", item.name)
sendCommand(item, OFF)
]
}
end
//***************************************************************************************
//* *
//* D O O R S E N S O R R U L E S *
//* *
//***************************************************************************************
rule "A Door's State Changed"
when
Item vHouseDoor changed or
Item vPatioDoor1 changed or
Item vGarageDoor1 changed
then
{
// Get the door that opened
gDoorSensors?.members.filter(door|door.changedSince(now.minusSeconds(1))).forEach[ door |
pushover("The following door OPENED: " + door.name)
// Do stuff
//***********************************************************************************************************************************************
// SET TIMESTAMP WHEN DOOR OPENS *
//***********************************************************************************************************************************************
if(door.state == 1) {
gDoorSensorsTime?.members.filter(dt|dt.name == door.name+"_LastUpdate").head.postUpdate(new DateTimeType)
logInfo("RULE.DOORSENSOR", "Setting OPEN timestamp for door: {}", door.name)
}
//***********************************************************************************************************************************************
// GARAGE DOOR LIGHTING *
//***********************************************************************************************************************************************
if((door.name == "vGarageDoor1" && door.state == 1) && (NightState.state == ON && Light_Garage_Soffit.state == 0 && tGarageDoor1 == null)) {
logInfo("RULE.DOORSENSOR.Garage", "[INFO] Garage Door Opened. Creating OFF timer: " + timeout + " sec")
//TURN LIGHTS ON
sendCommand(Light_Garage_Soffit, 50)
//CREATE OFF TIMER
tGarageDoor1 = createTimer(now.plusSeconds(timeout)) [|
logInfo("RULE.DOORSENSOR.Garage", "[ACTION] Turning House/Garage Soffit Lights off. Reason: " + timeout + " sec Timer Expired")
tGarageDoor1 = null
sendCommand(Light_Garage_Soffit, OFF)
]
}
//***********************************************************************************************************************************************
// HOUSE DOOR LIGHTING *
//***********************************************************************************************************************************************
else if((door.name == "vHouseDoor" && door.state == 1) && (NightState.state == ON && Light_House_Soffit.state == 0 && tHouseDoor == null)) {
logInfo("RULE.DOORSENSOR.House", "[INFO] House Door Opened. Creating OFF timer: " + timeout + " sec")
//TURN LIGHTS ON
sendCommand(Light_House_Soffit, ON)
sendCommand(Light_Garage_Soffit, ON)
//CREATE OFF TIMER
tHouseDoor = createTimer(now.plusSeconds(timeout)) [|
logInfo("RULE.DOORSENSOR.House", "[ACTION] Turning House/House Soffit Lights off. Reason: " + timeout + " sec Timer Expired")
tHouseDoor = null
sendCommand(Light_House_Soffit, OFF)
sendCommand(Light_Garage_Soffit, OFF)
]
}
//***********************************************************************************************************************************************
// PATIO DOOR LIGHTING *
//***********************************************************************************************************************************************
else if((door.name == "vPatioDoor1" && door.state == 1) && (NightState.state == ON && Light_Garage_Soffit.state == 0 && tPatioDoor1 == null)) {
logInfo("RULE.DOORSENSOR.Patio", "[INFO] Patio Door Opened. Creating OFF timer: " + timeout + " sec")
//TURN LIGHTS ON
sendCommand(Light_Garage_Soffit, 22)
sendCommand(Light_House_Soffit, 10)
//CREATE OFF TIMER
tPatioDoor1 = createTimer(now.plusSeconds(timeout)) [|
logInfo("RULE.DOORSENSOR.Patio", "[ACTION] Turning House/Garage Soffit Lights off. Reason: " + timeout + " sec Timer Expired")
tPatioDoor1 = null
sendCommand(Light_Garage_Soffit, OFF)
sendCommand(Light_House_Soffit, OFF)
]
}
]
}
end