Hi. My OH system runs on a PI3 and OH 2.3 stable. For the main part it works and runs very well. I have a few worries about some entries in the log during startup (to be honest, it’s driving me mad!)…
This is my startup rule that aims to prevent all other rules from starting before OH and the bindings get it all together (a delay of 180 seconds).
`
var Timer MYStartup
//============================================================================
// Stuff that happens on startup
rule “Startup1”
when
System started
then
val ruleName = "Startup1"
if(SystemStarting.state == NULL){
logInfo(ruleName, "SystemStarting(1) = " + SystemStarting.state )
SystemStarting.postUpdate(ON)
logInfo(ruleName, "Start - SystemStarting - 180 sec timmer started (" + SystemStarting.state + ")" )
MYStartup = createTimer(now.plusSeconds(180), [|
logInfo("Startup1", "Requesting device REPORT" )
publish("broker", "/system/info/COMMAND", "REPORT")
Thread::sleep(2000) // sleep for 2 seconds
publish("broker", "/Water_Manager/COMMAND/REPORT", "ON")
Thread::sleep(1000) // sleep for 1 seconds
SystemStarting.postUpdate(OFF)
Thread::sleep(500) // sleep for 1/2 second
logInfo("Startup1", "180 sec timer expired - SystemStarting flag is now " + SystemStarting.state )
MYStartup = null
sendPushoverMessage(pushoverBuilder("Openhab Starting Finished").withUser(startup_pushgavin).withTitle("Openhab").withPriority(0).withSound("incoming"))
] )
Thread::sleep(500) // sleep for 1/2 seconds
logInfo(ruleName, "SystemStarting flag is now " + SystemStarting.state )
}
end
`
At the beginning of every other rule, I have …
if(SystemStarting.state != OFF){ return; }
Despite this, I still get errors like …
2018-06-05 14:05:08.612 [INFO ] [ipse.smarthome.model.script.Startup1] - SystemStarting(1) = NULL
2018-06-05 14:05:08.687 [INFO ] [ipse.smarthome.model.script.Startup1] - Start - SystemStarting - 180 sec timmer started (ON)
2018-06-05 14:05:32.621 [INFO ] [ipse.smarthome.model.script.Startup1] - SystemStarting flag is now ON
2018-06-05 14:05:32.658 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'BOM Rain Changed': The name 'SystemStarting' cannot be resolved to an item or type; line 78, column 5, length 14
2018-06-05 14:06:39.798 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-06-05 14:06:39.983 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-06-05 14:06:40.171 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2018-06-05 14:06:40.334 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-06-05 14:07:22.809 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SolarB State': The name 'SystemStarting' cannot be resolved to an item or type; line 53, column 5, length 14
2018-06-05 14:07:22.835 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SolarA State': The name 'SystemStarting' cannot be resolved to an item or type; line 21, column 5, length 14
2018-06-05 14:09:22.296 [INFO ] [ipse.smarthome.model.script.Startup1] - Requesting device REPORT
2018-06-05 14:11:02.156 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SOC UPDATE1': The name 'OFF' cannot be resolved to an item or type; line 25, column 29, length 3
2018-06-05 14:11:02.161 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SOC UPDATE1': The name 'OFF' cannot be resolved to an item or type; line 25, column 29, length 3
2018-06-05 14:11:02.161 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SOC UPDATE1': The name 'OFF' cannot be resolved to an item or type; line 25, column 29, length 3
2018-06-05 14:11:02.164 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'SOC UPDATE1': The name 'Total_Radiation' cannot be resolved to an item or type; line 39, column 6, length 15
Below are the rules that are referred to in these errors… (I have commented the line numbers of the lines referred to in the log)
//============================================================================
// BOM Rain prediction changed
rule "BOM Rain Changed"
when
Item Rainp changed
then
if(SystemStarting.state != OFF){ // this is line 78
return;
}
val ruleName = "BOM Rain Changed"
var msg = "BOM Rain prediction Changed from " + Rainp.previousState.state + "% to "+ Rainp.state + "%"
logInfo(ruleName,msg)
if(Rainp.state >=50){
sendPushoverMessage(pushoverBuilder(msg).withUser(rain_pushgavin).withTitle("Openhab").withPriority(0).withSound("falling"))
logInfo(ruleName,msg)
}
end
var floatA_reached = false
var floatB_reached = false
//============================================================================
// Push a message when each solar comntroller goes into float
rule "SolarA State"
when
Item Sol_A_State changed
then
if(SystemStarting.state != OFF){ // this is line 21
return;
}
val ruleName = "SolarA State"
logInfo("SolarA State","Sol_A_State Changed to " + Sol_A_State.state)
if(Sol_A_State.state=="FLOAT"){//
if(floatA_reached === false){
var msg = "Solar A Float"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushgavin).withTitle("Openhab").withPriority(0).withSound("spacealarm"))
floatA_reached = true
}
}else if(Sol_A_State.state=="FAULT"){
var msg = "Solar A FAULT"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushall).withTitle("Openhab").withPriority(2).withSound("alien"))
logError(ruleName,msg)
}else if(Sol_A_State.state=="EQUALIZE"){
var msg = "Solar A EQUALIZE"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushall).withTitle("Openhab").withPriority(0).withSound("alien"))
logWarn(ruleName,msg)
}else if(Sol_A_State.state=="NIGHT"){
floatA_reached = false
}
end
//============================================================================
rule "SolarB State"
when
Item Sol_B_State changed
then
if(SystemStarting.state != OFF){ // this is line 53
return;
}
val ruleName = "SolarB State"
logInfo("SolarB State","Sol_B_State Changed to " + Sol_B_State.state)
if(Sol_B_State.state=="FLOAT"){//
if(floatB_reached === false){
var msg = "Solar B Float"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushgavin).withTitle("Openhab").withPriority(0).withSound("spacealarm"))
floatB_reached = true
}
}else if(Sol_B_State.state=="FAULT"){
var msg = "Solar B FAULT"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushall).withTitle("Openhab").withPriority(2).withSound("alien"))
logError(ruleName,msg)
}else if(Sol_B_State.state=="EQUALIZE"){
var msg = "Solar B EQUALIZE"
sendPushoverMessage(pushoverBuilder(msg).withUser(power_pushall).withTitle("Openhab").withPriority(0).withSound("alien"))
logWarn(ruleName,msg)
}else if(Sol_B_State.state=="NIGHT"){
floatB_reached = false
}
end
//============================================================================
// Stuff that happens based on SOC - updated every 10seconds
rule "SOC UPDATE1"
when
Item Battery_Monitor_SOC received update
then
if(SystemStarting.state != OFF){ // ****This is line 25
return;
}
// val ruleName = "SOC UPDATE1"
// Update the Inverter load estimate based on the charge value minus the battery wattage
if(Sol_Rad.state != null){
var Number n1 = Battery_Monitor_P.state as DecimalType
var Number n2 = Sol_T_ChargeW.state as DecimalType
var invl=(n2 - n1)
Inv_Load.postUpdate(invl)
var Number pcsol = 0
if(Total_Radiation.state > 1){
pcsol = ((Sol_Rad.state as DecimalType)/(Total_Radiation.state as DecimalType))*100
}
Sol_pc.postUpdate(pcsol)
}
end
Questions…
Is it normal to get error messages when OH is starting? As far as I can tell, these rules do what they should once OH and the bindings are up and running.
Is there something I’m doing wrong - or perhaps a better way of doing this? I really have spent many hours trying to sort this out and I am now at a loss.
I would be very grateful for any help or advice
Thanks