Item files not read after start-up

I just upgraded to openhab 2.5.6 on my openhabian system.
my items files are not read when I start openhab, making a number of rules fail due to missing items.

The If I run:

sudo touch /etc/openhab2/items/*
After that it all works fine which leads me to believe there is nothing wrong with my item files.

I noticed this before on previous upgrades but solved it in the same manner. So I did not make much of it, but now realize this will also render my OH useless after a reboot (e.g. due to a power failure).

sudo openhab-cli clean-cache
Is not a solution…

Anyone else experience this?
What do I need to look for in the logs?

Indeed, that will only make it worse. People say that you need two or sometimes three restarts after a cache clear (which an upgrade does too) in order for the cache to properly repopulated.

See if your problem persists after allowing this recovery. If so, there are many threads about the timing of loading files.

3 Likes

I have been using OH from just before 1.8 and I can’t remember when this behavior started. Restarting always did take some time but eventually it would start to work.

Problem I have now is that rules fail because the items used in the rules do not exist until I trigger OH to read the files, it does not get back to normal by itself, I have to take action… I know timing can be tricky but it appears the files are not read too late, they are not read at all…

Well, it’s up to you, try the fixes suggested in the linked thread or not.

Sorry @rossko57 I did not want to sound unthankful. I did have look into that thread and I will probably delay the loading of rules as suggested. It is the “action” I was referring to. I have yet to try it. (if the described solution is not working I will add the "touch *.items with a sleep time too).

I understand that start-up timing, initialization, “rules based on events from things that have not started communicating” etc. is something you need to take into account when using rules. I understand it is like that. But that is when you need to deal with “the reality of the outside world”. OpneHab can not control how long it will take for e.g an MQTT thing to send a first status message to openhab. I understand that I need to take that into account when creating rules etc

The proposed "Hide the rules"for an amount of time so the items can load, appears to be a workaround and it overrides a start-up file that is maintained by OpenHab. So that kind of shows a flaw in openhab that we all accept (like I do now, as the system is up and running again and it works now…) The same way we all accept that “for a system to recover from a cache clean-up it needs to be re-started a couple of times”.

But anyway thank you for your reply, I did search the forum before I posted but did not find that one…

1 Like

Yes, it is a hack or bodge.
openHAB has been suffering from some variation of the underlying problem for years, including OH1. Exact symptoms depend on versions and your environment. I don’t know why it is so difficult to fix at source, but it is obviously something fundamental.