Reload item file without restarting OH2?

Hello Guys.
Is it possible from the Console to reload a single item file manually? Could be very usefull when creating new items and don’t wanna restart it all :slight_smile:

Yes, just save it, and OH should detect the file and reload.

But be aware that ALL Items get uninitialized (there are reasons for that, like Group memberships changing).
So in practice it generally messes other things up.

Yeah I also remembered as this… but the VS Code Extension doesn’t detect the new item when saving the item file…

That sounds more like a VSCode issue than an OH issue.

But like Garry said, just saving the file, or touching a file that hasn’t been edited, will cause OH to reload the file. It will also cause all the Items to reinitialize like rossko57 mentioned.

I have the same issue here. After every change I have to restart oh because the changed files are not loaded (no hint in the logs)

I’m on ubuntu 16.04 with manual install of oh2.1 to /opt

This issues exist since i switched to oh2. With 1.8 it was never a problem. To be honestly I gave up invastigating this some time ago. But any hints are always welcome.

Cheers
Sebastian

This is the frist instance that I recall anyone mentioning that rules files are not loading when changed on disk. Usually, the problem is they get loaded twice, once a failed load and another successful because of a quirk in the file system.

Did you post a question to the forum or file an issue?

Yes. Discussion can be found here

As mentioned in this post it work for a short time before it stopped again. No clue whats going on here and if it is related to vscode or not

1 Like

what does “for a short while” mean?
are you talking in minutes, hours, days or weeks?

For me on 2.2 the reloading seems to work.

As these days I make lots of small changes and does lots of reloads, I do reboot OH about once a week or so.
As extra, I make all my config changes on github that I then pull to the OH machine, using a button in OB that executes a command) Github tells me I have +1400 changes since Februari 2017)

Y

Yves

As I’m doing all this on my test system that is just manually started with the OH start.sh from time to time it means it worked for some starts. Can’t tell you the exact number.

But motivated by this thread I gave it another shot today.

Result:
The first time I started OH2 (tested with latest snapshot #1140) after booting my PC changes in the *.item file are registered by OH and mentioned in the log. This worked several times with different editors (gedit, vscode).

Then I stopped OH, restarted it again, tried both editors … no reloading of the exact same item file.
Shutdown and restart PC, edit with gedit … no reloading of the exact same item file.
Shutdown OH, clear cache+tmp, edit with gedit … no reloading of the exact same item file.
Shutdown and restart PC, completely new install of OH2 (to different folder), create new items file, start OH, edit with gedit … guess … no reloading :thinking:

I could go on with this for some time. Tried for about 2 hours different situations to find the parameter that determines if file reloading is working or not … but got it never working except this one first boot 2 hours earlier.

I have absolutely no clue if this behaviour is caused by OH, the OS, vscode or whatever …
Slowly I start to remember why I gave up the last time some months ago and just accepted the situation doing a restart of OH after every change in a config file.

And one last thing to complete confusion (at least for myself) … changes in the logging configuration in /userdata/etc/ are recognised and applied immediately … always

:thinking::roll_eyes::dizzy_face:

when you look at the logs, are you watching live to log:trail ?
I’m asking as this has shown me, when a edit file contains errors.
Also when github has helped me to see the differences in the files to find if the files contain a problem.

1 Like

Yes, I’m watching logs live with log:tail
Except this one case there were no log entries when saving the items file. I even tried it with an increased log level (Debug).

when you go to the folder where the files are saved, what is the timestamp of the files?
What is the time of the machine, could it be a problem of time settings?

Hi Yves,

this is a good hint. Just checked this…

Time stamp is correct. Everything is on the same machine.
BUT: When I edit the file (with gedit) and save it, time stamp is not updated! If have to hit F5 to update the time stamp in Nautilus file explorer :thinking:
Second shot was to do everything with the console. So I watched the time stamp with ls -l and edited the file with nano. Time stamp gets updated immediately.
In all cases OH2 does not reload the changed config.

So it look like there is a problem with the OS (Ubuntu 16.04) that file updates don’t get recognized correctly.

1 Like

it has probably to do with docker


-> Further reference information is available on the capabilities(7) - Linux man page
* call fanotify_init(2);

is a CAP_SYS_ADMIN

–> add to docker run: --cap-add=SYS_ADMIN
or cap_add:
- SYS_ADMIN
in docker-compose.yml

Because it works now again for me :slight_smile: worked before when openab ran in privileged mode aswell, which gave me the capababilities idea