Hi, i have some issues with my default.rules transferred from OH1. Did check with Eclipse-Studio but does not show any hints…my guess that there is some issue with NULL/UNDEF/UNDEFINED…which i not 100% managed to understand…
Can someone shortly check the error logs+my default.rules file. Many Thanks
2017-10-12 22:31:14.918 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘default.rules’, using it anyway:
The operator ‘==’ should be replaced by ‘===’ when null is one of the arguments.
The operator ‘==’ should be replaced by ‘===’ when null is one of the arguments.
The operator ‘!=’ should be replaced by ‘!==’ when null is one of the arguments.
The operator ‘==’ should be replaced by ‘===’ when null is one of the arguments.
2017-10-12 22:31:14.923 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.rules’
2017-10-12 22:31:38.753 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘LivingRoom_Automation’: null
RULES FILE:
//import org.openhab.model.script.actions.*
//var Timer mytimer = null
var Timer myknxtimer = null
var Timer mytaptimer = null
var Timer myfloodtimer = null
// *************************D E F A U L T - R U L E S***********************************************
// ***************************************************************************************************
rule "Startup rules"
when
System started
then
EtaState_Switch.sendCommand(OFF)
ETA_high.sendCommand(OFF)
ETA_low.sendCommand(OFF)
Solar_Lock.sendCommand(OFF)
if (DanfossAnkiSelect.state == Uninitialized) { DanfossAnkiSelect.sendCommand(0) }
if (WebRadio.state == Uninitialized) { WebRadio.sendCommand(0) }
end
// ***************************************************************************************************
//rule "CPU Overload - Notification"
//when
// Item CPU_combined received update
//then
// if(CPU_combined.state > 20) {
// if (mytimer == null) {
// mytimer = createTimer(now.plusSeconds(60)) [|
// sendMail("adasdf.aklfjasdf@live.com", "Odroid U3 | CPU HighLoad", "---EoM---")
// executeCommandLine("sudo service mpd restart")
// WebRadio.sendCommand(0) ] }
// } else {
// if (mytimer != null) {
// mytimer.cancel
// mytimer = null
// }
// }
//end
// ***************************************************************************************************
rule "Water Level Alert - Notification"
when
Item Hofer_WaterLevel received update
then
if (Hofer_WaterLevel.state instanceof DecimalType) {
if (Hofer_WaterLevel.state < 22000) {
sendMail("adasdf.aklfjasdf@live.com", "NG4 | Water Level Alert | " + Hofer_WaterLevel.state + " mm", "---EoM---")
}
} else {
Hofer_WaterLevel.postUpdate(NULL) // or UNDEF on OH2
}
end
// ***************************************************************************************************
rule "PVisland Voltage below 23V Alert - Notification"
when
Item PVislandVolt received update
then
if (PVislandVolt.state instanceof DecimalType) {
if (PVislandVolt.state < 23) {
sendMail("adasdf.aklfjasdf@live.com", "PVisland | Battery Voltage Level Alert | " + PVislandVolt.state + " V", "---EoM---")
}
}
end
// ***************************************************************************************************
rule "MyTap Presence - Timestamp"
when
Item FRISTAR_Power received update
then
if( FRISTAR_Power.state > 15 && FRISTAR_Switch.state == ON) {
if (mytaptimer == null) {
postUpdate(MyTapStamp, new DateTimeType())
mytaptimer = createTimer(now.plusSeconds(60)) [|
mytaptimer = null
]
}
}
end
// ***************************************************************************************************
rule "SmartLOCK - Timestamp"
when
Item LockLog received update
then
postUpdate(MyLockStamp, new DateTimeType())
end
// ***************************************************************************************************
rule "SmartMeter HighLoad - Notification"
when
Item PowerTotal received update
then
if( PowerTotal.state > 1800 ) {
if (myknxtimer == null) {
myknxtimer = createTimer(now.plusMinutes(5)) [|
sendMail("adasdf.aklfjasdf@live.com", "NG5 Smartmeter - High Load - " + PowerTotal.state + "W", "---EoM---") ] }
} else {
if (myknxtimer != null) {
myknxtimer.cancel
myknxtimer = null
}
}
end
// ***************************************************************************************************
rule "SmartMeter SuspiciousLoad - Notification"
when
Item PowerTotal received update
then
if (PowerTotal.averageSince(now.minusMinutes(40)) > 800) { sendMail("adasdf.aklfjasdf@live.com", "NG5 Smartmeter | Suspicious Load - " + PowerTotal.averageSince(now.minusMinutes(40)) + "W", "---EoM---") }
end
// ***************************************************************************************************
rule "LivingRoom_Automation"
when
Item pvmeter received update
then
if (pvmeter.averageSince(now.minusMinutes(15)) > 60 && LivingRoom_Switch.state == OFF && Solar_Lock.state == OFF && now.getHourOfDay() >= 7 && now.getHourOfDay() <= 15) { sendCommand(LivingRoom_Switch, ON) }
end
// ***************************************************************************************************
//rule "Solar Pool-Heater_Automation ON"
//when
// Item PowerTotal received update
//then
// if ((PowerTotal.averageSince(now.minusMinutes(10)) < (-90)) && Gas_Switch.state == OFF && Solar_Lock.state == OFF && now.getHourOfDay() >= 9 && now.getHourOfDay() <= 17) { sendCommand(Gas_Switch, ON) }
//end
//
//rule "Solar Pool-Heater_Automation OFF"
//when
// Item PowerTotal received update
//then
// if ((PowerTotal.averageSince(now.minusMinutes(10)) > 5) && Gas_Switch.state == ON && Solar_Lock.state == OFF && now.getHourOfDay() >= 9 && now.getHourOfDay() <= 17) { sendCommand(Gas_Switch, OFF) }
//end
// ***************************************************************************************************
rule "SmartLOCK Log Update - Notification"
when
Item LockLog received update
then
sendMail("adasdf.aklfjasdf@live.com", "SmartLOCK Notification | " + LockLog.state, "---EoM---")
end
// ***************************************************************************************************
rule "Kitchen Flood Alarm - Notification"
when
Item KitchenFlood_Alarm received update ON
then
sendMail("adasdf.aklfjasdf@live.com", "KitchenFlood-Sensor | Alarm/Notification", "---EoM---")
end
// ***************************************************************************************************
rule "EverMisc Flood Alarm - Notification"
when
Item Ever2spring_Flood received update
then
if (Ever2spring_Flood.state == 255) { sendMail("adasdf.aklfjasdf@live.com", "EverMisc Flood-Sensor | Alarm/Notification", "---EoM---") }
end
// ***************************************************************************************************
rule "Basement Flood Alarm - Notification"
when
Item Fibaro_FloodAlarm received update ON
then
if (myfloodtimer == null) {
sendMail("adasdf.aklfjasdf@live.com", "Basement Fibaro Flood-Sensor | Alarm/Notification", "---EoM---")
myfloodtimer = createTimer(now.plusSeconds(300)) [|
myfloodtimer = null
]
}
end
// ***************************************************************************************************
rule "Repeater Presence - Notification"
when
Item RepPres_Switch changed from ON to OFF
then
sendMail("adasdf.aklfjasdf@live.com", "MiRepeater Presence - OFF Notification", "---EoM---")
end
// ***************************************************************************************************
rule "ETA SH20_Start/Stop Logger"
when
Item EtaKesselState received update
then
if (EtaKesselState.state=="Heizen" && EtaState_Switch.state==OFF) {
executeCommandLine("sudo /etc/openhab2/conf/scripts/etastart.sh")
EtaState_Switch.sendCommand(ON) }
else
if (EtaKesselState.state=="Bereit" && EtaState_Switch.state==ON){
executeCommandLine("sudo /etc/openhab2/conf/scripts/etastop.sh")
EtaState_Switch.sendCommand(OFF) }
end
// ***************************************************************************************************
rule "ETA HighState - Logger"
when
Item PufferState received update
then
if (PufferState.state > 90 && EtaKesselState.state=="Heizen" && ETA_high.state==OFF) {
ETA_high.sendCommand(ON)
sendMail("adasdf.aklfjasdf@live.com", "PSC-1000 is HIGH reaching " + PufferState.state + "% at " + RestO2state.state + "% residual oxygen.", "---EoM---")
}
else
if (PufferState.state < 85 && ETA_high.state==ON) { ETA_high.sendCommand(OFF) }
end
rule "ETA LowState - Logger"
when
Item PufferState received update
then
if (PufferState.state < 30 && ETA_low.state==OFF) {
ETA_low.sendCommand(ON)
sendMail("adasdf.aklfjasdf@live.com", "PSC-1000 is LOW reaching " + PufferState.state + "%", "---EoM---")
}
else
if (PufferState.state > 35 && ETA_low.state==ON) { ETA_low.sendCommand(OFF) }
end
// ***************************************************************************************************
rule "Solar_Automation"
when
Item pvmeter received update
then
if (Solar_Lock.state == OFF && now.getHourOfDay() >= 9 && now.getHourOfDay() <= 15) {
if (pvmeter.averageSince(now.minusMinutes(15)) > 80 && Solar_Switch.state == OFF) { sendCommand(Solar_Switch, ON) }
else
if (pvmeter.averageSince(now.minusMinutes(15)) < 50 && Solar_Switch.state == ON) { sendCommand(Solar_Switch, OFF) }
}
end
// ***************************************************************************************************
rule "Select Radio Station"
when
Item WebRadio received command
then
switch(receivedCommand) {
case 0 : executeCommandLine("mpc -h 192.168.1.4 -p 6600 stop")
case 1 : executeCommandLine("mpc -h 192.168.1.4 -p 6600 play 1")
case 2 : executeCommandLine("mpc -h 192.168.1.4 -p 6600 play 2")
case 3 : executeCommandLine("mpc -h 192.168.1.4 -p 6600 play 3")
}
end
// ***************************************************************************************************
rule "DanfossAnki TempSelect"
when
Item DanfossAnkiSelect received command
then
switch(receivedCommand) {
case 0 : LC13Thermostat_Setpoint.sendCommand(10)
case 1 : LC13Thermostat_Setpoint.sendCommand(28)
}
end
// ***************************************************************************************************
rule "LivingRoom TOGGLE via MiniMote"
when
Item MiniMote_B3 received update ON
then
if (LivingRoom_Switch.state == OFF) LivingRoom_Switch.sendCommand(ON)
else LivingRoom_Switch.sendCommand(OFF)
end
// ***************************************************************************************************
rule "Radio ON via MiniMote"
when
Item MiniMote_B1 received update ON
then
if (WebRadio.state == 0) WebRadio.sendCommand(1)
else WebRadio.sendCommand(0)
end
// ***************************************************************************************************
rule "Radio OFF via MiniMote/DoorBell"
when
Item MiniMote_B1h received update ON or
Item DoorBell received update ON
then
WebRadio.sendCommand(0)
end
// ***************************************************************************************************
rule "Router ON via MiniMote"
when
Item MiniMote_B2 received update ON
then
Router_Switch.sendCommand(ON)
PV_Switch.sendCommand(ON)
executeCommandLine("sudo service bluetooth start")
end
// ***************************************************************************************************
rule "Router OFF via MiniMote"
when
Item MiniMote_B2h received update ON
then
Router_Switch.sendCommand(OFF)
end
// ***************************************************************************************************
rule "AllWater ON via MiniMote"
when
Item MiniMote_B4 received update ON
then
FRISTAR_Switch.sendCommand(ON)
MaxKalk_Switch.sendCommand(ON)
WellWater_Switch.sendCommand(ON)
end
// ***************************************************************************************************
rule "HouseNr_Switch ON via Sunset"
when
Channel 'astro:sun:local:set#event' triggered START
then
HouseNr_Switch.sendCommand(ON)
end
// ***************************************************************************************************
//rule "PVNG4_Off via Sunset"
//when
// Item PVng4_sunset received update ON
//then
// PVng4_Switch.sendCommand(OFF)
//end
// ***************************************************************************************************
rule "RainPump Trigger"
when
Item MyDailyRain received update
then
if (MyDailyRain.state > 0 && Everspring_Switch.state==OFF) {
Everspring_Switch.sendCommand(ON)
}
end
// ***************************************************************************************************
rule pvmeter_sum
when
Item PVng5Mono_Power changed or
Item PVng5Poly_Power changed
then
if (PVng5Mono_Power.state instanceof DecimalType && PVng5Poly_Power.state instanceof DecimalType) {
pvmeter.postUpdate((PVng5Mono_Power.state as DecimalType) + (PVng5Poly_Power.state as DecimalType))
} else {
pvmeter.postUpdate(NULL) // or UNDEF on OH2
}
end
// ***************************************************************************************************
// ***************************************************************************************************
// sendMail("ben@home.com", "FIRE ALARM!!", "The fire alarm has been activated!!!")