Kodi/XBMC binding not working with Kodi 16.1 and openhab 1.8

Hi all,

i am trying to set up my openhab configuration with a link to Kodi (both running on the same RPI3).
But I can not receive any information from Kodi in openhab. I do get the following log, but I don’t get any information which would help me to solve the problem.

See my config and log below.
Where am I able to configure the rsPort in Kodi? I do only see one configuratuin field for the webserver. Do I need to use the same port for both ports? Because this is also not working :frowning:

openhab.cfg:
######################## XBMC Binding ########################### xbmc:Wohnzimmer.host=127.0.0.1 xbmc:Wohnzimmer.rsPort=9090 xbmc:Wohnzimmer.wsPort=8090 xbmc:Wohnzimmer.username=openhab xbmc:Wohnzimmer.password=

items:
String Kodi "Kodi [%s]" (TV) {xbmc="<[#Wohnzimmer|System.State]"} String Player "Player [%s]" (TV) {xbmc="<[#Wohnzimmer|Player.State]"}

sitemap:
Frame label="TV" { Text item=Kodi label="Kodi [%s]" icon="television" Text item=Player label="Player [%s]" icon="television" }

egrep “xbmc|ERROR” /var/log/openhab/openhab.log:
2016-07-17 18:50:55.297 [DEBUG] [.b.xbmc.internal.XbmcActivator] - XBMC binding has been started 2016-07-17 18:50:56.575 [ERROR] [binding.xbmc.rpc.XbmcConnector] - [127.0.0.1]: Websocket error: Invalid Status Code 200 2016-07-17 18:50:56.577 [ERROR] [binding.xbmc.rpc.XbmcConnector] - [127.0.0.1]: Websocket error: Invalid Status Code 200 2016-07-17 18:50:56.585 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.610 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.612 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.622 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.625 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.628 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.630 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.633 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.635 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.637 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.639 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.642 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.644 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.646 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.648 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.650 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.652 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.654 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.656 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.658 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.660 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.662 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.664 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.665 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:56.668 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.165 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.167 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.169 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.171 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.177 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:50:57.179 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:51:55.443 [ERROR] [binding.xbmc.rpc.XbmcConnector] - [127.0.0.1]: Websocket error: Invalid Status Code 200 2016-07-17 18:51:55.444 [ERROR] [binding.xbmc.rpc.XbmcConnector] - [127.0.0.1]: Websocket error: Invalid Status Code 200 2016-07-17 18:51:55.445 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, 2016-07-17 18:51:55.447 [ERROR] [h.c.p.n.NettyAsyncHttpProvider] - Invalid attachment NettyResponseFuture{currentRetry=5, ....

Any thoughts or help on this would be great.
Thanks to all.

I think yout port configurations are mixed up. wsPort must be set to 9090. The web socket port can only be changed in the AdvancedSettings.xml (see http://kodi.wiki/view/JSON-RPC_API#WebSocket).
rsPort must be set to the port you have configured within Kodi.

Thanks for your help.
This helped me to understand the difference between ws and rs Port.

I changed wsPort to 9090, I do not have an AdvancedSettings.xml file. therefore this defaul port should be used. Am I right?
For the rs port I configured 8090 in kodi and in my openhab.cfg

But still, it won’t work. I do now get the following log:
pi@Homeserver:~ $ egrep "xbmc|ERROR" /var/log/openhab/openhab.log 2016-07-18 20:15:51.140 [DEBUG] [.b.xbmc.internal.XbmcActivator] - XBMC binding has been started 2016-07-18 20:15:53.142 [DEBUG] [binding.xbmc.rpc.XbmcConnector] - [127.0.0.1]: Websocket connection error 'Verbindungsaufbau abgelehnt: /127.0.0.1:9090 to ws://127.0.0.1:9090/jsonrpc' 2016-07-18 20:15:53.143 [ERROR] [b.x.internal.XbmcActiveBinding] - Connection failed for '#Wohnzimmer' on 127.0.0.1

Maybe there is a problem with the empty password. I have alway tried it with a non-blank password.

Setting a password won’t solve the problem :frowning:

Maybe it is very simple:
did you allow remote control of Kodi?

If this is not the solution some more ideas:

  • are any other processes running on the Raspberry that may use port 9090
  • I am not an expert in firewall settings on Linux but maybe port 9090 is blocked even for local access via (127.0.0.1)

I figured out one thing. I did not have openhab-addon-action-xbmc installed before, but installing does not solve the problem either. But what is this addon for?

@MHerbst
Thanks, I tried both, only having first checkbox active and having both activ.
Even if the first should be sufficient or?
Nevertheless … No success… :frowning:

Looking for the ports says the following, but I am not aware of a mechanism how to find out which application is using the port. Is there any way how to do so?
pi@Homeserver:~ $ netstat -an | grep 9090 tcp6 0 0 ::1:9090 :::* LISTEN pi@Homeserver:~ $ netstat -an | grep 8090 tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN tcp6 0 0 :::8090 :::* LISTEN

Any other thoughts why I still can’t get this running?
Thanks for any help.

I know that netstat can print the pid of the process using the port. But I can’t remember the option. But something is strange. Port 9090 is in use only by tcp6 listening on ::1. There is no entry for tcp so maybe that’s the reason while the connection does not work.

So is there something I nedd do to get wsport 9090 running?
Currently I do not have a AdvancedSettings.xml at all…
Do I need to configure it somewhere ?

You could try to set a different port in the advancesettings.xml (you can find the documentation in the Kodi Wiki: http://kodi.wiki/view/Advancedsettings.xml).
I have also found a forum entry with a similar problem (http://forum.kodi.tv/showthread.php?tid=218006). Maybe it will work if you disable tcp6.

If I have time this weekend I will install Kodi on my Raspberry and try it.

Hi Martin,

thanks for all your help.
I followed your recomandation and tried to deactivate ipv6 with the entry net.ipv6.conf.all.disable_ipv6 = 1 in the /etc/sysctl.conf.

After that I do get the follwing, but it seems as if ipv6 would still be acitve. Or?
pi@Homeserver:~ $ netstat -an | grep 9090 tcp 0 0 127.0.0.1:58742 127.0.0.1:9090 VERBUNDEN tcp 0 0 127.0.0.1:58696 127.0.0.1:9090 VERBUNDEN tcp6 0 0 :::9090 :::* LISTEN tcp6 0 0 127.0.0.1:9090 127.0.0.1:58696 VERBUNDEN tcp6 0 0 127.0.0.1:9090 127.0.0.1:58742 VERBUNDEN

If I now check my openhab log, I don’t see any error anymore, but I do only receive the Player.State but not System.State. Any idea why this is so?

Deactivating tcp6 completely seems not be so easy. I read several posts about it. Sometimes it seems to be necessary to use a grub parameter.
Regarding System.State I can’t help you right now. I have just started to play with the XBMC binding. I am also using version 1.9 togehter with OH 2. So things can be a bit different. But I will try it with my configuration this weekend and see what happens there.