How to reload conf files without restarting OH2?

Hi all,

I made my way through installation of OH2 2.0.0.b2 on a vanilla Synology Diskstation DS214play (Intel Atom CE5335 2x1,6GHz, 512MB RAM) on DSM 5.2 with all your help here which was adventure of its own. OH2 is now up and running, bindings are also well working. Nice work!

However, OH2 doesn’t seem to automatically reload conf files. I have to configure a lot in .items, .sitemap, and .rules and I have to manually shutdown OH2 on its console and restart the OH2 server (which takes around 2 minutes) everytime I do changes on any of the files.

Is there a way to configure auto reload or to enforce reload on the console?

Thanks
Hans

In the console you can type log:tail to see what OpenHAB is actually doing. Sitemaps, Items, Rules, etc, etc, should be reloaded upon change in OpenHAB2b2. At least, that is working just fine on my setup.

That helps.This means that my setup (or the Synology package) is broken. I am using log tail all the time using the debug start script but there is no indication about rereading any config. When I change my conf files and wait for 30minutes, there is no change propagated.

In a working environment, is there a log entry once a new config is (re)read?

Same problem here. Did you solve it? how?

Unfortunately, no resolution yet.

Problem is gone here. I chnaged nothing (just other hard- and software, kidding), only one restart of OH. Now I see in log, only secends after saving that OH takes differences. I don’t know why.

I have the same problem here with current Snapshot (openhab2-offline-2.0.0-SNAPSHOT.deb from https://openhab.ci.cloudbees.com/job/openHAB-Distribution/) of OH2 - should be the current nightly?

But I have to say, that I edit my config files via an AFP-Share and thought about something that checks the filechange which will not be triggered by the changes made via a network share.
But even if I “touch” the files on the CLI where I run OH2 nothing is reloaded according to the log.

Some suggestions what I could try?

Thnx,
Patrik

Hi again,

I’ve done some more testing. I had the config directory symlinked from /var/openhab2/ to /etc/openhab2/. I’ve removed that link an the files itself now reside back in /etc/.

After a restart of openhab the log tells me, that a save of the files is recognized again:

21:29:09.848 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model '_default.sitemap'

So the problem seems to rely on the Symlink. This worked without any problems in OH1.
Maybe someone could confirm?

So long,
Patrik

Hi @pmayer,

you mentioned problems with symlinked config/models? I discovered the same issue today and I’am able to confirm your observation. I have my OH-config folder symlinked to another folder because i’m using docker and i need a persistent folder. Refreshing the models without symlink works perfect, but it fails with a symlink.

I have investigated this problem and found out, that OH2 uses Eclipse Smarthome AbstractWatchService. See

The problem is the WalkFileTree which ignores per default symlinks. FileVisitOption.FOLLOW_LINKS should passed into the Walker.

I will start a discussion on github and prepare a PR.
Thx for the hint with the symlinks :slight_smile:

2 Likes

Sorry, that I’m late on reply…

That’s good news. I’m glad that I could help :slight_smile:
Thanks for you investigation and effort. Is this fix already in oh2b4?

Cheers,
Patrik

Hi Patrik,

this was the PR: https://github.com/eclipse/smarthome/pull/2036 and it was merged 29 days ago.
B4 has been release for 13 days.

I think it should be included.

/Chris

1 Like

It seems on my environment, after I changed conf/sitemaps/demo2.sitemap, new item does NOT apprear on sitemap.

I notice some configuration can be done in openhab.cfg in OH1 which mentioned here.
https://groups.google.com/forum/#!topic/openhab/A0SBwLANu-Y

Howeve, for OH2 enviroment, are we supposed to put the configuration lines somewhere else?
I can NOT find the openhab.cfg file.

And my OH2 build is pretty new which is #445.

Thank you.

Did you read the OH2 documentation? A few things changed:
http://docs.openhab.org/tutorials/migration#configuration-and-folder-structure

Instead of the global configurations/openhab.cfg file, there is now an individual file per add-on in conf/services. The : prepended to each configuration property is removed in the new .cfg files.

Thank you very much for sharing the link. I did NOT read that before.

" The : prepended to each configuration property is removed in the new .cfg files."
By this line, it seems “folder:sitemaps=10,sitemap” should be put in something like folder.cfg without folder: prepend.
Am I correct to say that?

If so, as I do not find folder.cfg, should I create a blank folder.cfg?
Or is there any extra steps I should go through?

Thank you very much.

That would be correct yes. I am however not sure if the folder configuration option is still available. @Kai ?

Here is what I have done, which has no effect.
For folder:sitemaps=10,sitemap,

1 add folder.cfg.
2 add sitemaps line.

$cat services/folder.cfg
sitemaps=10,sitemap

Can any expert shed some light?

Could you explain what you are actually trying to accomplish? I have the slight feeling you are on the wrong track… :slight_smile:

sure.

on my environment, after I changed conf/sitemaps/demo2.sitemap, new item does NOT apprear on sitemap.

In detail, in conf/sitemap/demo2.sitemap,
at beginning, one line,
Switch item=orvibo_s20_ACCF2392F5BE_power label=“s20” icon=“switch”

Later, I change it as
Switch item=orvibo_s20_ACCF2392F5BE_power label=“s20” icon="switch"
Switch item=zwave_device_1579c2c54b2_switch_binary label=“zwave_binary” icon=“switch”

I know by restart OH2, the new item will show on basic UI.
However, I wonder whether this can happen without restarting OH2.

So I have done what my previous post describe by.
1 https://groups.google.com/forum/#!topic/openhab/A0SBwLANu-Y
2 http://docs.openhab.org/tutorials/migration#configuration-and-folder-structure

Unfortunately, it seems new item still NOT show without restarting OH2 by this setting.

Can you shed some light for this auto reloading config files issue?
Thank you very much.

$log:display

I got this
02:00:33.635 [ERROR] [.core.internal.folder.FolderObserver] - Cannot activate folder watcher for folder ‘/opt/openhab_sep2/conf’: Function not implemented

It seems related to my setting.
For folder:sitemaps=10,sitemap,

1 add folder.cfg.
2 add sitemaps line.

$cat services/folder.cfg
sitemaps=10,sitemap

Does some expert shed some light?
Thank you very much.

Hello, you seem to have another problem clouding your experience.

You do not need the folder.cfg. Delete it.

OH2 reloads sitemaps automatically. Normally you just have to refresh the page after 2-3 seconds.

Your example looks valid. I expect the error to be some place else. Please have a close look at the log while you are editing the sitemap file. Here is one example you could add to hopefully see a successful change:

Text label="Testing Refresh..."

Which version of openHAB2 are you on / when did you set it up?