Here is one of the rules below… (I created a trivial one as well, which does not fire automatically either)
rule "FloorHeating"
when
Time cron "0 * * * * ?"
then
if (TemperatureFloor.state < ((FloorThermostatSTP.state as DecimalType)-0.2 ) ) {
if (FloorHeater.state == OFF) {
FloorHeater.sendCommand(ON)
postUpdate(Heating_Cooling_Mode,"Heating")
}
}
else if ((TemperatureFloor.state) > ((FloorThermostatSTP.state as Number)+0.2) ) {
if (FloorHeater.state == ON) {
FloorHeater.sendCommand(OFF)
postUpdate(Heating_Cooling_Mode,"Off")
}
}
end
Hi, The problem is not with the code. As I wrote, the rule is executing properly if I trigger it manually from UI. The problem is that the rule is not triggered every minute, it isn’t not executed by the system.
Ok, I created a trivial rule, @schossel… You will love this, but it unfortunately reassures my problem. @spy0r Thanks for the suggestion, I fight for this a bit more and I will do a clean one.
rule "Testrule"
when
Time cron "0 * * * * ?"
then
var Number NewCounter=(TestCounter.state as Number)+1
TestCounter.postUpdate(NewCounter)
logInfo("logThermostat","TestCounter incremented {}", NewCounter)
end
Which should show in the log every minute would have done the trick and the less complicated the better. It is just for testing.
You didn’t even post a conclusion of your test. You just wrote your code.
I wrote this reassures the problem. The rule is running on manual trigger and incrementing the test item and put the message into the log. But it does not run every minute.
Check your system time. I have the time displaying on my sitemap and it is way off. I have been having a heck of a time fixing it. I have edited my locale, time zone, etc. The 3.0 system is so different that I’m having a hard time finding things.
I purged openhab and re-installed and restored the previous configuration.
Unfortunately the rules still not executed…
Checked system time, that is sharp.
The solution for the problem was to rebuild OH3 from scratch. I wiped the OS, reinstalled Openhabian and OH3. I did not restore the Openhab backup to avoid migrating potential database issues. I installed the necessary addons, bindings, transformation manually from UI, then deployed the config files to restore my config. Rules worked fine after this. This was much less of a work than I expected.
rule “Heating Governor”
when
Item Heating_Monitoring_Temp changed or
Item Heating_Temp changed
then
var Number house_heat = (Heating_Monitoring_Temp.state as Number)
var Number heat_setpoint = (Heating_Temp.state as Number)
val Number offset = 0.4
if (house_heat >= (heat_setpoint + offset)) {
ZWaveNode016SSR302TwoChannelBoilerActuator_Switch.sendCommand(OFF)
} else if (house_heat < (heat_setpoint - offset)) {
ZWaveNode016SSR302TwoChannelBoilerActuator_Switch.sendCommand(ON)
}
end
My version of boiler on off depending on temp
Curious Why do you have
I had the same issue as the OP. When I moved to OH 3.0.1, my rules worked if I used the config files. When I moved them to the Main UI they stopped working. I could trigger them manually, but the timed events did not trigger. They are only simple rules to turn on/off lights at certain times.
Interestingly, when I upgraded to OH 3.1, the rules started working properly. But, unfortunately, the upgrade broke other things, like MyOpenhab. I’m still working on that one.
Make sure you are running the correct version of Java.
My rules did not want to run on Java 16. Also no logging…
All got fixed when I went down to Java 11.
Thank you @faf This was the problem! My openHAB 3 ran on Java 17 without any obvious issues, execept that the rules just didn’t work anymore. There were no errors in the logs. With Java 11 the rules are back
For Ubuntu/Linux users: I posted instructions on how to configure the Java version for openHAB running as systemd-based service here. Just replace openhab2 with openhab and zulu8 with zulu11.