[SOLVED] Systemstart Rule trigger if I change any Item

Hello
Does anyone knows why the Systemstart Rule is executed?

Rule:

rule "Systemstart" 
when
     System started
then
    logInfo("System Start", "Rule Systemstart executed ")
end

Item file:

Switch notused

Log:

2019-05-16 14:14:13.155 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Systemstart.rules'
2019-05-16 14:14:18.319 [INFO ] [.smarthome.model.script.System Start] - Rule Systemstart executed 
2019-05-16 14:15:05.283 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'dummy.items'
2019-05-16 14:15:55.893 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'dummy.items'
2019-05-16 14:16:04.004 [INFO ] [.smarthome.model.script.System Start] - Rule Systemstart executed 

I think this is build in. Whenever you change a item file these rule is triggered.

Yes maybe but in the docs you can read:

https://www.openhab.org/docs/configuration/rules-dsl.html#system-based-triggers

System started is triggered upon openHAB startup, after the rule file containing the System started trigger is modified, or after item(s) related to that rule file are modified in a .items file.

For my understanding I have no items edit related to this rule, therefor the rule should not executed.

Regards
Steffen

Yes but the parser does not know which items are used in which rule(s), so it has to parse them all and this causes the System started trigger to apply.

So we should probably change that sentence in the docs because it clearly implies that if you change a .items file that all the System started Rules will fire.

It wouldn’t be just that one Rule. If you change a .items file containing any Items that are referenced from any Rule in that .rules file the whole .rules file would be parsed and the System started Rule triggered.

Of course, this presupposes that OH is working as described in the docs which Markus indicates is not the case. I’ve honestly never paid attention to this in a very long time. I’ve eliminated the bulk of my System started Rules…

I just ran a quick test and it does appear that all System started Rules get fired for any change to a .items file whether or not the Items appear in the .rules file with the System started Rule. I’ll submit a PR to change that sentence to make the true behavior of OH more clear.

Did it ever work differently?

NOTE: https://github.com/openhab/openhab-docs/pull/979

This is weird because I don’t recall this being how it worked, but I’ve noticed lately every time I reload one item file, it seems like all items reload and all system start up rules run. Basically, it’s like the system restarts
Maybe I never noticed it.

I don’t think so. I noticed this behavior when I entered some commands for status request of my Tasmota sockets into the rule.

Thanks all for your discussion and clarification.

That part has always been the case - imagine if you had a Group in one file and added/removed member Items in another, it’s the simple way to sort it out.