OH4 no reloading of changed rules files

Changed rules are no more reloaded in OH4. Is that feature gone for ever or has it to be configured?

Hi @Garbisa,

similar issue here; are you using rules-files?

I have a similar issue for things files since an update from OH3 to OH4 yesterday, Monday. After a restart of the open hab service with

sudo systemctl start openhab.service

I lose a things which are in files. From then onwards, I can replace / delete and recreate the things files, but they don’t show up again. The only way that works is to clear the cache with

sudo openhab-cli clean-cache

When I do that, I can recreate things until next restart of the openhab service. Seems to be bug, that cannot be a feature; I already deleted the installation manually, deleted the cache folders, the JSON databases, etc. or I am too stupid?!
Unfortunately, I cannot share any helpful log files, as after the restart, the log does not show to load the things-files anymore.

Happy to get suggestions…

Neither of this. There were code changes but they do get reloaded just like in 3.X.
If you happen to have an error in there though the rules will neither appear nor work.
And this can be for a number of reasons related to OH4 or not, including breaking changes in 4.0.

That’s then probably because it’s broken.

This is likely unrelated to OH4 changes and sign of a problem within your config that has been existing before. A typical mistake to avoid is to mix files and UI config e.g. to have things or items of the same name defined twice, one in UI one in files, but of course there’s many ways to create broken configs if you use file input.

Hi @mstormi,

thanks for the hint. I also don’t believe that we have a severe bug here, as this would be too obvious.

However, no real clue where to start beyond putting in the config step by step and see what happens. It is a quite huge installation with ~100 things and >>500 items. No UI used for any config, no double names etc.

However, I would expected when cleaning everything it should work. In case you have a smart idea where to start, let me know…

To test i just added a single Space on a working rule file (no errors). In OH3 such a saved rule file would have been reloaded.

I just tested myself to edit my rules file and one of my things file and each time I see a log that tells me that the file is loaded:

22:25:55.712 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'maison3.rules'

22:26:43.731 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'maison3.rules'

22:27:42.398 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'freebox.things'

22:27:55.696 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'freebox.things'

So at least, there is no general issue with file monitoring.

Test was done on a RPI.

That’s no change so an invalid test.

Any change in the file is a change, even adding a simple blank line, and trigger a file reloading.

No, plus there have been changes in 4.0

Please read the result of my test just 3 messages before.

afaik a touch my.rules should suffice to result in a reload, as the file observer doesn’t check if a file was actually changed, but only if the timestamp changed.
This was true at least until OH3, I didn’t check this behavior since.

Unlike openHAB1 to openHAB3.x, openHAB4.0 doesn’t trigger a System started though, if a .rules file is changed (which is correct, at least if taking the trigger name seriously :wink: )

My test yesterday evening shown that the system started rule was triggered. It was not the case before OH4 I believe.

I just tested and it does not. You have apparently to edit and do a change in the file to trigger a reload.
It is different to the behaviour in OH3.

On my OH4 even real changes don’t reload the rules files. So is there another way to force a reload, as restarting the OH4 for each change takes allways several minutes.

No. If so, there’s something else wrong with your files, e.g. some error inside that makes it fail to load.
Note you might have been using code that does no longer work in OH4 due to breaking changes so “but I didn’t change anything” does not apply. Enable debugging and check if it gets loaded on a restart.

Hi thanks for your answer. I’ve almost 30 rules files. All are loaded at system start - some with some warnings, but none with errors. None of them are reloaded after changes.
So it looks I will have to stop/start OH4 after each change. Will wait for OH4.1

This is not a known error, it’s apparently working for everybody else. It’s a problem specific to your installation so You should rather go analyze this detail what’s specific on your system.
As this isn’t a bug, don’t expect changes in 4.1.

Passively waiting half a year for 4.1 will probably not solve the issue. We need to troubleshoot and pinpoint if this is a problem in your configuration/installation, or some corner case bug in openHAB. If there is a bug, it should be fixed as soon as possible, especially if it’s a regression in 4.0, and you shouldn’t have to wait for 4.1.

Unfortunately I’m not sure what would be the next steps. Did we already establish which system you’re running openHAB on? And from which version did you upgrade? Anything in logs during startup? Are other files reloading (e.g. things and items)?

What is your server OS? Is it Pi OS?

It is probably not so common to have so many rule files. For example, I have myself all my rules in one unique file.

I would suggest to remove all files with warnings and then restart OH and see if updating a file is triggering a reload.
If still not, try with just one rule file.

1 Like

Hi Lolodomo, thanks - will follow your advice.
I did an Upgrade from OH3.4.4 on Windows 2016
When starting I have several messages like

Can't find the request for http://openhab.xxx.local:8083/rest/events's Observer
Can't find the request for http://openhab.xxx.local:8083/rest/addons/services's Observer 
Can't find the request for http://openhab.xxx.local:8083/rest/addons/services's Observer

Perhaps they should “observe” changed files?