[WORKAROUND] Openhab 2.5.5 - Issue with items files / items not resolved / empty groups

openhabian on RPI4, openHAB version: 2.5.5

It seems like my items-files are not loaded correctly on system startup.
Items and group members are missing - everything is fine after touching all items files manually.
Below is an example of my group definitions; first call is before touching each items file, 2nd thereafter. Have a look at the differing members numbers:

openhab> items list g*
gLight_Switch (Type=GroupItem, Members=18, State=NULL, Label=null, Category=null, Groups=[gLight])
gTimerSwitchConfig (Type=GroupItem, Members=0, State=NULL, Label=null, Category=null)
gTimepicker (Type=GroupItem, Members=0, State=NULL, Label=null, Category=null)
gBlind_Pos (Type=GroupItem, Members=0, State=NULL, Label=null, Category=null)
gHeating (Type=GroupItem, Members=0, State=NULL, Label=null, Category=null)
gPresSim_SwitchOff (Type=GroupItem, Members=0, State=OFF, Label=null, Category=null)
openhab> items list g*
gLight_Switch (Type=GroupItem, Members=25, State=NULL, Label=null, Category=null, Groups=[gLight])
gTimerSwitchConfig (Type=GroupItem, Members=6, State=NULL, Label=null, Category=null)
gTimepicker (Type=GroupItem, Members=3, State=NULL, Label=null, Category=null)
gBlind_Pos (Type=GroupItem, Members=19, State=NULL, Label=null, Category=null)
gHeating (Type=GroupItem, Members=22, State=NULL, Label=null, Category=null)
gPresSim_SwitchOff (Type=GroupItem, BaseType=SwitchItem, Members=4, State=OFF, Label=null, Category=null)

Is anyone having similar issues?
I never had this problem before yesterday (upgrade of OH2 to 2.5.5), but I’m not sure which exact version I used before.

1 Like

After upgrading needing to restart is very common. The last time I upgraded i had the same issue until I restarted openHAB.

Unfortunately the problem remained after restarting and even after cleaning the cachevia openhab-cli. The only thing that helped so far was touching all items files while openhab was running.

Try to restart without clearing the cache.

2 Likes

Background: every version of openHAB has more or less difficulty at load time with getting the load sequence of various resources correct. Exact effects depend on the host system and configuration, and can vary between OH versions even in the same environment.

There’s a version of this where rules start before all Items are available; and another version where Items never come available (until touched etc.)

If your problem persists even after a reload without messing with cache (i.e. you allow the cache to do its job), see also -

1 Like

After further examination, I can confirm that the issue only occurs after cleaning the cache.
Anyhow - cleaning the cache is sometimes recommended after updates and to me, the risk of forgetting to restart twice to have all items assigned to my groups seemed to high.

Note: In my configuration, defective groups are not always obvious at a quick glance…

So I implemented the following workaround:
I added the below rule to my ruleset:

rule "System started"
	when
			System started
	//   or Time cron "	0 0/1 * 1/1 * ? *"
	then
    /*
        After a restart with cleaned cache (openhab-cli clean-cache), items files are not read correctly.
        This script waits 5 minutes and thereafter starts a bash script that touches all items files
        to force a re-read of them by openhab.
        After that, all items and groups should be resolved
    */
		var DateTime startTime = now.plusMinutes(5)
		createTimer(startTime) [|
            executeCommandLine("/etc/openhab2/scripts/touch_items_files.sh",60000)
            sendMail("<me>@<mailserver>", "openHAB restarted", "openHAB restart successfull!")
        ]
    end

which calls the bash script “/etc/openhab2/scripts/touch_items_files.sh” :

# this script cycles across all items files and touches them to make openhab re-read them
# between each items file a delay of 5 seconds tries to ensure that the items file is processed correctly by openhab

for f in /etc/openhab2/items/*.items; do
	touch "$f"
	sleep 5
done

So far as I know the update process does that anyway. I think sometimes there’s a knee-jerk advice to do it again, of doubtful value.

How often are you updating? To what end?

If that is the case it is done poorly. My experience several times underscores the fact it usually needs to be done. at least during the past year.

That describes the issue correctly - i have several .items files - they are named with numbers 00_ - 99_ - but this seems not to have the effect that they are loaded in the sequence i want them to be loaded.
Actually i am checking to have a single .items-file to store alle things at once. So - this is a bit unhandy - but i guess will resolve the loading sequence issue.

just had the same issue when going to 2.5.5.

a reboot fixed it at least for me.

Hi @rossko57

sorry for the late reply, I was offline for a few days…
How often do I update?
Rarely, maybe once or twice a year.
But as I’m doing things like this typically late in the evening (maybe not the best idea :wink:) I just love to have as robust processes as possible. Because after several months of not dealing with major issues I tend to forget those litte tricks like “You have to reboot twice to have the system running after you clean the cache!”

Hi @JoeRu,

I don’t believe my issue was related to having several items files. The respective items and groups were defined within one single file, but still some items were not included in the group at first try.

Did moving to one single items file help in your case?

So. Putting it all in one file does not solve the issue. I can approve that it is happening only when deleting the cache in the first startup. A second restart resolves the missing items.

The switch from V 2.4.x to V2.5.x is a nightmare, honestly saying. I had also this issue, the functions of groups are just killed, sometimes items are missed after the update. And a mass of other problems (bundle issues, habpanel crashs, memory errors, bindings are not starting, things and items will be deleted during the run of the system, etc.). It will cost me weeks to come back to a stable system. V5 was not a good job, I guess.

Why version 2.5.x is so pure tested?

There were major changed from 2.4 to 2.5 and breaking changes were documented in the Release Notes.

The next release 3.0 is has even more backend changes to complete the move away from the Eclipse Smart home namespace.

One bindle that is quite troublesome is restdocs. The path changed. Ig OH has an invalid addon defined, it restarts ALL addons every minute, trying to load the bad one.