2017-07-07 21:12:55.327 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘test.sitemap’
2017-07-07 21:12:55.341 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘test.sitemap’ is either empty or cannot be parsed correctly!
2017-07-07 21:12:55.345 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file ‘/etc/openhab2/sitemaps/test.sitemap’: null.
java.lang.NullPointerException
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.getAllItems(PageChangeListener.java:125)[117:org.eclipse.smarthome.io.rest.sitemap:0.9.0.b5]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.updateItemsAndWidgets(PageChangeListener.java:75)[117:org.eclipse.smarthome.io.rest.sitemap:0.9.0.b5]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.sitemapContentChanged(PageChangeListener.java:217)[117:org.eclipse.smarthome.io.rest.sitemap:0.9.0.b5]
at org.eclipse.smarthome.io.rest.sitemap.SitemapSubscriptionService.modelChanged(SitemapSubscriptionService.java:277)[117:org.eclipse.smarthome.io.rest.sitemap:0.9.0.b5]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:286)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:136)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:234)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:297)[122:org.eclipse.smarthome.model.core:0.9.0.b5]
at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:206)[98:org.eclipse.smarthome.core:0.9.0.b5]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
2017-07-07 21:12:55.421 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘test.sitemap’
I actually defined only one item. It’s a dimmer called “eg_wz_dimmer”. My objective is to use the switch to turn the light on or off while using the slider to fine tune the intensity of the light.
I can just say that there is no problem to use the same item for different elements in a sitemap, even of different kinds like in your example. Your problem is elsewhere.
At first glance your sitemap looks ok to me. Did you check the file permissions of the test.sitemap file? Is the user running openHAB able to read the test.sitemap file?
What kind of editor are you using? Could it be that you have a problem similar to:
I am not a linux pro. How am I supposed to check it? Log in via SSH and then what?
Microsoft Visual Studio Code
Actually, the sitemap is loading as expected. I wouldn’t have expected a problem when I didn’t come along this error message in the log. So, one could argue that I shouldn’t care. But I do care
I would try to recreate the file from scratch. It’s a simple one and it shouldn’t take you too much time.
How do you copy the file over to the OH2 system? (are you using openHABian with a rPi3?)
If the sitemap loads ok, then file permissions is not the problem. However, if you’d like to double check then first check the user who is running openHAB:
Login using SSH into your openHAB server and execute the following command:
So here we can see that on my system the openhab user is running openHAB.
Next check the file permissions:
marcel@openhab:~ $ ls -l /etc/openhab2/sitemaps
total 12
-rw-r--r-- 1 openhab openhab 6408 Jun 7 21:53 default.sitemap
-rw-rw-r-- 1 openhab openhab 230 May 15 20:54 readme.txt
marcel@openhab:~ $
The file permissions for my default.sitemap are as follows:
Read/Write permissions for the owner (in this case openhab)
Read permissions for the group (in this case the group is also called openhab. The first openhab is the user, the second openhab is the group)
Read permissions for other (meaning any other user).
I also see the ‘Configuration model ‘test.sitemap’ is either empty or cannot be parsed correctly!’ errors in my log file. I do not experience the nullpointer exceptions, but I think that they have the same cause.
You are editing your sitemap file from a remote computer. When saving the file, openHAB is informed by the OS of a change in the file and starts reloading the file. However, since you’re saving the file over the network on the remote node running openHAB this saving takes too long, or openHAB starts reading too quickly. So the file is simply not complete when openHAB reads it. In the end openHAB succeeds in reading the sitemap as can also be seen by the last line of your log:
2017-07-07 21:12:55.421 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.sitemap'
I wouldn’t say that this is all normal and how it should be, but it is nothing to worry about.
This looks very much like the old “file encoding” issue that I had a while back.
What are you using to edit your files? Notepad++ by any chance??? It has something to do with UTF8 encoding, choose “Encoding”, “Encode in UTF-8-BOM” from the menu’s then save. Oddly though, I get a similar “Configuration model ‘home.rules’ is either empty or cannot be parsed correctly!” error with my rules file regardless of encoding, so am having to use normal notepad.exe for editing (or I edit with notepad++ locally on Windows, upload the file, then run vi to edit on my linux appliance, then make a simple change and save the file and voila, it works)
On Windows I am using Notepad++ and Visual Studio Code (with the openHAB extension). On Mac, when I use TextWrangler the get the exception, but gedit does not.