The Kodi/XBMC binding not work

  • OpenHAB 1.8.3
    org.openhab.action.xbmc-1.8.3.jar and org.openhab.binding.xbmc-1.8.3.jar in the addons
  • OpenELEC 6.0.3 with Kodi 15.2
    HTTP webserver and “allow other programs/services/etc” activ

openhab.cfg:

############################# XBMC Binding #######################################
xbmc:livingRoom.host=192.168.100.26
xbmc:livingRoom.rsPort=80
xbmc:livingRoom.wsPort=9090
xbmc:livingRoom.username=kodi
xbmc:livingRoom.password=kodi
xbmc:refreshInterval=60000

logback.xml add:

<logger name="org.openhab.action.xbmc" level="TRACE"/>
<logger name="org.openhab.binding.xbmc" level="TRACE"/>

item:

Switch XbmcLiving_PlayPause "Living Play/Pause"  (gKodiWZ) { xbmc=">[#livingRoom|Player.PlayPause]", autoupdate="false" }

log:
grep -i xbmc /opt/openhab_1.8.3/logs/openhab.log

2016-11-04 11:36:45.935 [DEBUG] [.a.xbmc.internal.XBMCActivator] - XBMC action has been started.
2016-11-04 11:36:46.205 [DEBUG] [.b.xbmc.internal.XbmcActivator] - XBMC binding has been started
2016-11-04 11:36:46.221 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.221 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.222 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.222 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.223 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.223 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 11:36:46.224 [DEBUG] [b.x.internal.XbmcActiveBinding] - XBMC Refresh Service activate()
2016-11-04 11:36:46.224 [DEBUG] [b.x.internal.XbmcActiveBinding] - XBMC Refresh Service updated()
2016-11-04 11:36:46.232 [INFO ] [.service.AbstractActiveService] - XBMC Refresh Service has been started
2016-11-04 12:01:27.637 [TRACE] [b.x.internal.XbmcActiveBinding] - Attempting to access the named instance 'livingRoom' before the binding config has been loaded
2016-11-04 12:01:27.638 [WARN ] [b.x.internal.XbmcActiveBinding] - Received command (ON) for item XbmcLiving_PlayPause but no XBMC connector found for #livingRoom, ignoring

I don’t know whats wrong!

Make sure that your web service port in Kodi/xbmc is indeed running on port 80 and not 8080.

Yes, it is port 80

In the log i see
Access the instance before config is load.
But why?

Can you open the web interface in a browser? Do you have the firewall running on the Kodi/XBMC client?

Yes, i can open it in my Webbrowser

Do you need to type in the username and password?

I test both.
Currently i must type it, if i open it in webbrowser.

I don’t have authentication configured on my Kodi clients, unless you have a specific reason for having that in place I would remove it.

Currently working for me:

I can access xbmc on port 80 and control it using a browser, but I still have to use port 8080 as rsPort!

services/xbmx.conf

# Hostname / IP address of your XBMC host (required). Example:
whz.host=192.168.1.11

# Port number for the json rpc service (optional, defaults to 8080). Example:
whz.rsPort=8080

# Port number for the web socket service (optional, defaults to 9090). Example:
whz.wsPort=9090

# Username to connect to XBMC. (optional, defaults to none). Example:
#whz.username=kodi

# Password to connect to XBMC. (optional, defaults to none). Example:
#whz.password=xbmc

items

String vDirectPla_WHZ "Direct Play" <switch> (gMultimedia)

String Kodi_Title_WHZ "Kodi Title" {xbmc="<[#whz|Player.Title]"}
String Kodi_Open_WHZ "Kodi Open" {xbmc=">[#whz|Player.Open]"}
String Kodi_Play_WHZ "Kodi Play" {xbmc=">[#whz|Player.PlayPause]"}

sitemap

sitemap default label="A9_1"
{

	
    Frame label="Multimedia" {
    	Switch item=vSW_Power_WHZ mappings=[ON="Ausschalten"]
    	Switch icon="soundvolume-66" label="Lautstärke" item=MarantzButtonPress mappings=["VolumeUp"="lauter","VolumeDown"="leiser","Mute"="Mute"]
    	Selection item=harmonyhub_hub_Wohnzimmer_currentActivity icon="soundvolume" label="Audio" mappings=[PowerOff=Aus, Radio=Radio, "Kodi - Audio"=Kodi,AirPlay=Airplay, "Fire TV - Audio"=FireTV]
    	Selection item=harmonyhub_hub_Wohnzimmer_currentActivity icon="television" label="TV" mappings=[PowerOff=Aus, Fernsehen=TV, "Fire TV - TV"=FireTV,"Kodi - TV"=Kodi, "PS4 - TV"=Playstation, "Apple TV - TV"=AppleTV]
    	Selection item=harmonyhub_hub_Wohnzimmer_currentActivity icon="cinema" label="Beamer" mappings=[PowerOff=Aus, "PS4 - Beamer"=Playstation, "Fire TV - Beamer"=FireTV, "Apple TV - Beamer"=AppleTV]
    	Switch icon="player" label="Direkt Play" item=vDirectPla_WHZ mappings=["smb://192.168.1.10/music/export/Eva/Eva.m3u"="Eva","smb://192.168.1.10/music/export/Christian/Christian.m3u"="Christian"]
    	Switch item=Kodi_Play_WHZ mappings=[Play="Play", Pause="Pause"]
    	Switch icon="player" label="Direkt Play" item=vDirectPla_WHZ mappings=["smb://192.168.1.10/video/Konzerte/Konzerte.m3u"="Konzerte","smb://192.168.1.10/music/export/Kinderparty/Kinderparty.m3u"="Kinderparty"]
    	
	}
}

rules

rule "direct play kodi"
when
    Item vDirectPla_WHZ received command
then
	
    if(harmonyhub_hub_Wohnzimmer_currentActivity.state != "Kodi - Audio" && harmonyhub_hub_Wohnzimmer_currentActivity.state != "Kodi - TV") {
    	sendCommand("harmonyhub_hub_Wohnzimmer_currentActivity", "Kodi - Audio")
    	    createTimer(now.plusSeconds(15)) [|
                        sendCommand(Kodi_Open_WHZ,vDirectPla_WHZ.state.toString)
    	]
    } else {
    	sendCommand(Kodi_Open_WHZ,vDirectPla_WHZ.state.toString)
    }

    	
end

Remeber for OH2 that you need to remove beginning xbmc from the front of your config url and other items

Now it works with and without auth!
If i change the “allow other programs”, i must restart the RasPi. THX