Rules no longer executing after upgrade to OH 4

Hi all,

I used the quiet time of the year to finally upgrade my OpenHAB from 3 to 4.3. This is a large setup, with several hundreds of items and thousands of lines of Rules DSL code (in .rules files) for automation, grown and in use for quite a few years. After some hard work everything appeared fine at a very first glance - until I noticed that none of my rules gets triggered. Never. Not even the most simple ones.

I therefore stripped down the rules configuration, temporarily removed all the .rules files, restarted OpenHAB, and started by adding very simple, brain-dead test rules (like printing a log message or switching a light on when a simple item changes, or cron-triggered every five seconds). The log file says that the rules file is loaded, without errors or warnings, whenever the file changes. The rule from the file shows up in the web interface as it should. But again, the rule from the file was never triggered - even though the items triggering them are there, working, and are changing their state as they should in the web interface and in my sitemap.

I then added a rule via the web interface, just to see what happens. Same result: the rule is there, shown as “idle”, but it never triggers.

Does anyone have an idea what might be going on here? Am I missing something simple?

I got exactly the same problem, no rules firing anymore after upgrade to 4.3; manual triggering via settings works.

without any .rules nor logfiles showing i doubt anyone is able to help ^^

Thank your for your quick reply.

Below you may find a simple rule with the task to switch on my amplifier when a Yamaha streamer goes from standby to ON. The corresponding Item changes its value correctly, but the rule never fires.

This happens with every rule wether it would be event triggered or by a cron expression - no execution at all.

The rules had worked for years and the sudden stop came with the upgrade to OH 4.3.

Rearranging the rules to multiple .rules files didn’t help, rebooting the RPI neither. All possible incompatibilities with time-formats were checked, Visual Studio Code with OH-extension running does not report any problems in the .rules files. The Event-Log doesn’t show any errors - but no rule execution is visible.

So I suppose there might be a general issue with making my rules not fire.

Exemple rule:
rule “MusicCastAn”
when
Item GF_LivingRoom_MusicCast changed from OFF to ON
then
GF_LivingRoom_Stereo.sendCommand(ON)
end

The corresponding Eventlog entries are:
2024-12-29 13:26:15.567 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘GF_LivingRoom_MusicCast’ received command ON
2024-12-29 13:26:15.570 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘GF_LivingRoom_MusicCast’ predicted to become ON
2024-12-29 13:26:15.574 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘GF_LivingRoom_MusicCast’ changed from OFF to ON

This has driven me crazy several times in the past months (@florian-h05 can sing a song about my curses) and I never found a solution. If it happened NONE of my rules were executed.

I even debugged deeply into the core (which only revealed that the item changes ARE detected (“Item ‘xxxx’ received command ON”) and the scheduler does submit rules to be executed but they then get never executed by the java scheduler).

I never really found out a good reason why it eventually worked again. Once it was that I switched on and off debugging (jpda). Sometimes clearing cache or rebooting helped. The day before yesterday I was almost stuck but then found out that one manually added binding was missing a dependency which I noticed by an exception in the very beginning of the logs during startup. After I replaced it with the right binding file, all of a sudden even my rules worked again.

I am aware that this doesn’t sound like a systematic approach but at least I wanted to share my tries. Maybe at some time we will find the real root cause.

1 Like

@stefan.hoehn:
Uff - you were right and thank you so much for your inputs!

I switched rule-logging off and to info again, then I (re-)installed HABApp in the Configuration Tool, not knowing whether that might be relevant or not. Finally I restarted the openhab.service and voilĂ , all rules up and running - bizarre!

Thank you again for your support and a happy new year!

sounds fishy, never experiencend such an behavior ^^

Of course. If you never experienced it, it cannot exist. Glad that you are so keen to boost people’s motivation to report bugs in the future.

I made a bit of progress, though not quite in a way that gives me much confidence. I did a clean re-install. During my first attempts to get OH 4 running, I used a “full” backup from my OH 3 system (i.e., one made with openhab-cli backup --full), and I repeatedly ran into the problem described in my initial post - not even the most simple rules doing anything, and zero log messages indicating what might go wrong.

I now tried again, but this time after a clean re-install of 4.3 I used a backup that was created without the --full option. Now it seems that (at last for the moment) things are working.

It appears that when restoring my full backup from OH 3 into an OH 4 installation something gets “restored” that shouldn’t be there and that seriously messes up the installation.

1 Like

what’s wrong with you?

Just because I’m writing that I’ve never experienced this doesn’t mean that this problem doesn’t exist ^^

Thank you for your help.

I have the same problem (or at least the same symptom) and don’t have a solution but one thing you should check out is mentioned here Rule engine not running although bundle active? - #15 by mstormi