Open maglnet opened 7 years ago
Yes, the "System started" trigger is indeed not reliable for such cases - I assume we would first need https://github.com/eclipse/smarthome/issues/1896 to find the right moment when everything is up and fully loaded...
Thank you for your response. What would be the way to go?
I'll try to add the calculated Items to persistence / restoreOnStartup and call the script after a delay of one minute, that should be enough, imho.
I'll give feedback in some days if my idea works :)
The following seems to work for now (restarted about 10 times, no Warning appeared):
rule "Public Holiday"
when
Time cron "0 0 0 * * ?" or
System started
then
createTimer(now.plusSeconds(15)) [|
callScript("holiday")
]
end
Sounds like a viable workaround.
Hi, I have a similar issue.
Sometimes (in 10% of the cases), my rules are even triggered before all my items are loaded. Then I get something like this in my log:
2017-11-19 22:22:26.696 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'some.rules' 2017-11-19 22:22:30.524 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Some rule': The name 'someItem' cannot be resolved to an item or type; line 286, column 8, length 35 2017-11-19 22:22:35.540 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'some.items'
On top of that, many of my rules are triggered because of restoreOnStartup. I would expect items to be restored, and after that rules are initialized.
I think it makes sense that the following sequence is applied during the start of OH:
Link to Community topic: https://community.openhab.org/t/keep-when-item-received-update-rules-from-running-during-restoreonstartup/
Makes sense. Note that we can only reliably guarantee such an order once https://github.com/eclipse/smarthome/issues/1896 is solved.
I experience similair problems. And the logs shows the rules are read (and executed) before the item and script files. I also read https://github.com/eclipse/smarthome/issues/1896 discussion. While one could make it as complex as possible, wouldn't it be a first step to trigger the system started event after all userdata was loaded? After the discuission in #1896 evolves, that trigger/state could also be update to incorperate all the services ready, handler available or whatever is decided to be a good moment to start the rules.
Hello,
I sometimes (about 25%-50% of restarts) experience the following log messages at startup:
my rule:
When the log message appears the holidays wont be calculated at startup, at midnight the script is called normally and holidays are calculated.
I feel like scripts should be loaded prior the rules?
I'm running
openHAB 2.1.0-SNAPSHOT Build #816
on a RaspberryPI 3.best regards, Matthias