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.
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-08-03 16:31:44.549 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'main.sitemap'
STRIPPED DOWN 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…
.