- Platform information:
- Hardware: Raspberry Pi 4 8GB
- OS: Raspbian
- openHAB version: 3.2
I’ve been using OH2 on a RPi3 for some time now, running near to 100 different devices all connected to the same little server that I’ve been improving for the past 3 years or so.
It all was great. Took me months to optimize OH2 but in the last year or so I barely needed to do anything because it just runs very smooth.
I’ve now installed OH3 in my new RPi4 and my oh my, I’ve spent some days on this already and I’m not new to this so I can only imagine the pain of someone new to the software.
The learning curve is really, really steep and this makes me wonder if it wouldn’t simply be easier to move once and for all to HA.
And thinking about this makes me actually sad, because I’ve invested SO MUCH TIME with OH2. I mean, really a lot. One would hope OH3 would be an IMPROVEMENT over OH2 but so far, days have gone by trying to use it and it has been problems after problems…
The latest problem I have is, my old rules are not working and I read everywhere that “they should”.
So here is one of my many rules that I had working on my previous OH2.
rule "Sensor 433mhz Sonoff Bridge"
when
Item Sensor433Mhz changed
then
//val variable = newArrayList("names")
//logInfo("433mhz","433MHz signal received [" + Sensor433Mhz.state + "]")
//val actions = getActions("mqtt","mqtt:broker:mqtt-broker")
var Timer offTimer = null
val Number hours = now.getHour
val PorSol = new DateTime(Por_Sol.historicState(now).state.toString)
switch Sensor433Mhz.state {
case "79E006": {
if ((now.isAfter(PorSol).toString == "true" || hours < 3)
&& Luz_Entrada_Frente.historicState(now).state.toString == "OFF") {
Luz_Entrada_Frente.sendCommand(ON)
if(Alexa_Boas_Vindas.state == ON) {
offTimer = createTimer(now.plusSeconds(10), [|
if(Sensor433Mhz.state.toString == "29E006" || Sensor433Mhz.state.toString == "1961E6") {
Conta_Alexa.sendCommand(Alexa_Msg_Boas_Vindas.state.toString)
}
])
}
offTimer = ScriptExecution.createTimer(now.plusSeconds(20), [|
Luz_Entrada_Frente.sendCommand(OFF)
])
}else if(Alexa_Boas_Vindas.state == ON) {
offTimer = createTimer(now.plusSeconds(10), [|
if(Sensor433Mhz.state.toString == "29E006" || Sensor433Mhz.state.toString == "1961E6") {
Conta_Alexa.sendCommand(Alexa_Msg_Boas_Vindas.state.toString)
}
])
}
}
case "1961E6": {
if((now.isAfter(PorSol).toString == "true" || hours < 6)
&& Luz_Corredor.historicState(now).state.toString == "OFF") {
Luz_Corredor.sendCommand(ON)
offTimer = createTimer(now.plusSeconds(30), [|
Luz_Corredor.sendCommand(OFF)
])
}
}
case "1A23A6",
case "E53803": {
if((now.isAfter(PorSol).toString == "true" || hours < 6)
&& Luz_Corrimao.historicState(now).state.toString == "OFF") {
Luz_Corrimao.sendCommand(ON)
offTimer = createTimer(now.plusSeconds(60), [|
Luz_Corrimao.sendCommand(OFF)
])
}
}
case "7CAC81": {
Alarme.sendCommand(ON)
}
case "7CAC82": {
Alarme.sendCommand(OFF)
}
case "1E9D56",
case "F504E6": {
Conta_Alexa.sendCommand("Atenção, chegou correio! Atenção, chegou correio!")
sendBroadcastNotification("Chegou correio a casa!")
}
case "644C68": {
Conta_Alexa.sendCommand("URGENTE! ATENÇÃO! FOI DETETADO FUMO EM CASA! URGENTE! ATENÇÃO! FOI DETETADO FUMO EM CASA!")
sendBroadcastNotification("FUMO DETETADO EM CASA!!!")
}
case "0A2F13": {
sendBroadcastNotification("O portão da garagem foi aberto!")
}
case "0A2F19": {
sendBroadcastNotification("Portão da garagem fechado.")
}
}
if(Sensor433Mhz.state.toString !== "") {
offTimer = createTimer(now.plusMinutes(1), [|
Sensor433Mhz.postUpdate("")
])
}
end
As I said, this file is running flawlessly on my OH2 installation.
This error message inside openhab.log is what I get whenever the script is suppose to run:
2021-09-29 05:02:28.492 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'sensor433mhz-1' failed: An error occurred during the script execution: null in sensor433mhz
If old rules were supposed to work in OH3, what is going on here?
Thank you in advance for any help.