[SOLVED] OHv2: Why would updating one items file trigger other rules files to reload?

I updated an items file named weather.items… it triggered the reload of .rules files?
I have also noticed this, when updating one rules file; it triggers other rules files to reload.

2019-01-03 11:15:10.614 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'weather.items'
2019-01-03 11:15:33.841 [INFO ] [lipse.smarthome.model.script.max01.0] - loading rule and initialise state(s)
2019-01-03 11:15:33.841 [INFO ] [se.smarthome.model.script.MainGate.0] - loading rule and initialise state(s)
2019-01-03 11:15:33.854 [INFO ] [lipse.smarthome.model.script.max01.1] - blnEmailLock_rPiLowMem = false
2019-01-03 11:15:33.844 [INFO ] [pse.smarthome.model.script.weather.0] - loading rule and initialise state(s)
2019-01-03 11:15:33.861 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'weather.items'
2019-01-03 11:15:33.890 [INFO ] [smarthome.model.script.watersystem.0] - loading rule and initialise state(s)
2019-01-03 11:15:35.703 [INFO ] [clipse.smarthome.model.script.init.0] - loading rule and initialise state(s)
2019-01-03 11:15:35.708 [INFO ] [clipse.smarthome.model.script.Shed.0] - loading rule and initialise state(s)
2019-01-03 11:15:35.720 [INFO ] [clipse.smarthome.model.script.init.1] - do nothing
2019-01-03 11:15:51.078 [INFO ] [e.smarthome.model.script.sppro_bms.0] - loading bootstrap and initialise state(s)...

This has dire consequences when things are running and the rules get initialised or reset values.

For the event bus, modifying any of the “essential” files means a system start up! For clarity (as far as I know): modifying *.items, *.rules while openHAB is running, triggers a start up event on the bus.
If your rules are designed to not take in to consideration the above mentioned experience, means you need to rethink your rules. BTW: it happened (not in the same manner) in OH 1 also.

1 Like

Thanks :slight_smile:
IIRC, OHv1 only showed the file that was updated in tail openhab.log
OHv2 shows quite a lot of rule files being reloaded; I have to check, whether it does all of them.
I have sequential timers for sprinklers (and there was once an issue with timers continuing when reloading rules); so I had the fear of these being buggered up.
However, the timer I had running kept going and finished.

The lesson learned seems to be not to fiddle with items and rules in production when things are going on.

[I actually have a window from 16:00 to 23:50 when not much is going on (at present)… as I have lots of repeat daily automations. but no human/movement triggered events.]

My point was that you can avoid these situations, carefully writing your rules.

When you modify a *.items file, it reloads only the items in that file, but all rules with a system startup trigger will be triggered.

1 Like

Aha, now I understand… will have a look, whether I need those startup rules.
Most startup rules initialise items, which I can move into a single init.rules.

(Not all .rules have a at startup, why I did not see all rules reloaded)

Done… now only 2 out 10 rules files have System started clauses… :slight_smile: