Sitemap erroring, sort of?

I am working on integrating my new Sonoff devices using MQTT, so lots of changes going on while I work through the integration testing.

I am almost at the end of my testing and suddenly I start seeing an Error on loading the sitemap; this is not unusual for me, I am forever having typos, I go through my normal process and cannot find the cause of the error, I then load it into the ESH designer and all looks good too.
so to be on the safe side I start removing chunks of code until I am left with the simplest form of the sitemap that still causes the log outcome when it is loaded/refreshed.

I cannot see what is a problem with the syntax if you feel its something else then any clues as to how to best debug will be appreciated.

LOG Extract

==> /var/log/openhab2/openhab.log <==
2017-08-03 16:31:44.212 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'main.sitemap'
2017-08-03 16:31:44.242 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'main.sitemap' is either empty or cannot be parsed correctly!
2017-08-03 16:31:44.246 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file '/etc/openhab2/sitemaps/main.sitemap': null.
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent([122:org.eclipse.smarthome.model.core:0.9.0.b5]
2017-08-03 16:31:44.549 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'main.sitemap'


sitemap main label="MyHome Menu"
	//Frame label="Rooms" {
	//	Group item=MF_Living   label="Living Room"  icon="sofa" {
	//		Slider item=gLiving_Light_Dimmer label="Ceiling Dimmer [%.1f]" icon="light"
	//		Switch item=gLiving_Light_Switch label="Ceiling"
	//		Slider item=LRLamp_Brightness label="Lamp Dimmer [%.1f]" icon="light"
	//		Switch item=LRLamp_Switch label="Lamp"
	//		Switch item=temp_control label="Automated Temperature" icon="temperature"
	//		Switch item=LR_temp label="Room Temp" icon="temperature" mappings=[1="Hot", 2="Normal", 3="Cold"]
	//		Switch item=LR_humid label="Room Humidity" icon="water" mappings=[1="Wet", 2="Normal", 3="Dry"]
	//		Text label="LG TV"  icon="lg" {
	//			Switch item=HarmonyLivingRoomLGTV mappings=[PowerOn="On", PowerOff="Off", Mute="Mute", "VolumeDown"="Vol-","VolumeUp"="Vol+", Select="Sel"]
	//		}
	//		Text label="Nvidia Shield"  icon="nvidia" {
	//			Default   item=KodiShield_Control
	//			Switch item=HarmonyLivingRoomNvidia mappings=[Home="Home", Mute="Mute", "VolumeUp"="V+","VolumeDown"="V-", Select="Sel"]
	//			Switch item=HarmonyLivingRoomNvidia mappings=[DirectionLeft="Left", DirectionUp="Up", DirectionRight="Right",DirectionDown="Down", Back="Back", Sleep="Sleep"]
	//			Switch item=HarmonyLivingRoomNvidia mappings=[0="0", 1="1", 2="2",3="3", 4="4"]
	//			Switch item=HarmonyLivingRoomNvidia mappings=[5="5", 6="6", 7="7", 8="8", 9="9"]
	//		}
	//		Text label="Fujitsu Heat Pump"  icon="fujitsu" {
	//			Switch item=HarmonyLivingRoomFujitsu mappings=[PowerOn="On", PowerOff="Off"]
	//		}
	//		Text label="Kodi (Shield)" icon="kodi" {
	//			Switch    item=KodiShield_Mute icon="audiomute"
	//			Slider    item=KodiShield_Volume icon="audiovolume"
	//			//Selection item=KodiShield_Control mappings=[PLAY='Play', PAUSE='Pause', NEXT='Next', PREVIOUS='Previous', FASTFORWARD='Fastforward', REWIND='Rewind']
	//			Default   item=KodiShield_Control
	//			Switch    item=KodiShield_Stop icon="audiostop"
	//			Text      item=KodiShield_Title  icon="audiotitle"
	//			Text      item=KodiShield_ShowTitle icon="audiotitle"
	//			Text      item=KodiShield_Album icon="audioalbum"
	//			Text      item=KodiShield_Artist icon="audioartist"
	//			//Text      item=kodiShield_playuri
	//			//Selection item=kodiShield_input mappings=[Up='Up', Down='Down', Left='Left', Right='Right', Select='Select', Back='Back', Home='Home', ContextMenu='ContextMenu', Info='Info', ShowCodec='ShowCodec', ShowOSD='ShowOSD']
	//			//Selection item=kodiShield_systemcommand mappings=[Shutdown='Herunterfahren', Suspend='Bereitschaft', Reboot='Neustart']
	//			Text      item=KodiShield_MediaType icon="mediaplay"
	//		}
	//		Text label="Chromecast" icon="google" {
	//			Default item=ChromeCast_Control
	//			Slider item=ChromeCast_Volume icon=soundvolume
	//			//Text item=ChromeCast_PlayURI
	//		}
	//		Text label="Chromecast" icon="nvidia" {
	//			Default item=SHIELD_Control
	//			Slider item=SHIELD_Volume icon=soundvolume
	//		}
	//	}
	//	Group item=MF_Dining   label="Dining Room"  icon="diningtable" {
	//		Slider item=DRLight_Brightness label="Table [%.1f]" icon="light"
	//		Switch item=DRLight_Switch label="Table"
	//	}
	//	Group item=MF_Corridor label="Main Hallway" icon="corridor" {
	//		Slider item=gHallway_Light_Dimmer label="Ceiling [%.1f]" icon="light"
	//		Switch item=gHallway_Light_Switch label="Ceiling"
	//	}
	//	Group item=MF_Games   label="Games Room"  icon="steam" {
	//		Slider item=GamesRoomLight_Brightness label="Ceiling [%.1f]" icon="light"
	//		Switch item=GamesRoomLight_Switch label="Ceiling"
	//		Switch item=GamesRoomSwitch_Switch label="Console Switch" icon="poweroutlet-au"
	//		Text item=GamesRoomSwitch_Power label="Console Energy [%.1f W]" icon="energy"
	//		Switch item=GamesRoomHeater_Switch label="Heater Switch" icon="poweroutlet-au"
	//		Text item=GamesRoomHeater_Power label="Heater Energy [%.1f W]" icon="energy"
	//		Switch item=GRControl label="Scheduled Closedown" icon="switch"
	//		}
	//	Group item=MF_Office label="Office" icon="office"
	//	Group item=MF_Bed1   label="Sue & Paul Bedroom" icon="bedroom"
	//	Group item=MF_Bed3   label="Orian Bedroom" icon="bedroom"
	//	Group item=MF_Bed4   label="Guest Bedroom" icon="bedroom"
	//	Group item=MF_Bed2   label="Holly & Zac Bedroom" icon="bedroom"
	Frame label="MQTT Test"{
		Switch item=MQTTFAN label="FAN"
		Text item=MQTTLOCALFAN label="Local Sw FAN [%s]"
		Text item=Test_Wifi label="Wifi [%s dBm]"
		Text item=Test_Uptime label="Uptime [%s mins]"
		Text item=Test_Temp label="Temp [%.1f °C]"
		Text item=Test_Humid label="Humid [%s %%]"

So why did I say Error, sort of? Well as you will see by the attached screenshot the sitemap is working…


Are you using Samba shares to store the files to your OH2 system?

By the way: I think that you can also use:

commented out stuff here

instead of //

The error (and the code part throwing the error ) sound like an Item was not found or couldn’t be loaded.
To solve this first please try a simple restart of openHAB, if the error doesn’t disappear could you please check of one of these items you are including in your sitemap is not defined in your items file?

I suppose

2017-08-03 16:31:44.246 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file '/etc/openhab2/sitemaps/main.sitemap': null.

comes from the item Local Sw Fan, because it has no value.

Interesting three slightly different answers.

@Dim, I do indeed have the samba package installed and configured to advertise my OH configuration directory; I was using WinSCP (SFTP) to edit and upload the sitemap thoigh. So not sure that samba is relevant. Is there a test other than remove samba to test your idea?

@ThomDietrich, I had already restarted OH and the condition continued.

@hr3, this interesting, that would mean it would sort itself out when the value was set. and would still display sitemap ok, which it does. And presumably could be caused with poor exception handling, seems like an error is thrown when really at worst a WARN is better suited. If this was the case I should be able to set an item to null and replicate the issue easily, I will check it out.

Thanks for the responses, I will continue to investigate and advise what I conclude.


In this case, my post is not relevant. If you were using Samba to copy over the sitemap file, maybe you were experiencing what triller wrote (that 2 file events happen in series: one empty and one correct). Not the case here :slight_smile:

By the way: I agree with you. If the problem is due to the NULL state of an item, the log entry is a bit misleading.