Openelec/Kodi working for a brief moment

I just got into using openHAB, and after getting the onkyo addon to work, mqtt, and some other small things, I wanted to try XBMC, so I could set up some rules.

First thing I did was to use an example someone else already had made (sorry closed the page and now I cant find it again)

Items

String    XbmcLiving_State            "Living State [%s]"      { xbmc="<[#bedroom|Player.State]" }
String    XbmcLiving_Title              "Living Title [%s]"        { xbmc="<[#bedroom|Player.Title]" }
String    XbmcLiving_ShowTitle      "Living Show [%s]"      { xbmc="<[#bedroom|Player.ShowTitle]" }
Switch   XbmcLiving_PlayPause    "Living Play/Pause"     { xbmc=">[#bedroom|Player.PlayPause]", autoupdate="false" }
Switch   XbmcLiving_Stop             "Living Stop"               { xbmc=">[#bedroom|Player.Stop]", autoupdate="false" }
String    XbmcLiving_Notify            "Living Notify [%s]"     { xbmc="<[#bedroom|GUI.ShowNotification]", autoupdate="false" }

Rules

rule "Adjust living room lighting when XBMC starts/stops"
when
    Item XbmcLiving_State changed
then
    var String state = XbmcLiving_State.state.toString()
    
    switch (state.lowerCase) {
	 	case "play"  : Scene_Living.sendCommand(5)
	 	case "pause" : Scene_Living.sendCommand(1)
	 	case "stop"  : Scene_Living.sendCommand(1)
 	}
end

Sitemap

sitemap dolphin label="Main Menu"
{
	Frame label="XBMC"
	{
		Text item=XbmcLiving_State label="State [%s]"
		Text item=XbmcLiving_Title label="Title [%s]" visibility=[XbmcLiving_State==Play, XbmcLiving_State==Pause]
		Text item=XbmcLiving_ShowTitle label="Show [%s]" visibility=[XbmcLiving_State==Play, XbmcLiving_State==Pause]
		Switch item=XbmcLiving_PlayPause label="Play" icon="play" mappings=[ON="Play"] visibility=[XbmcLiving_State==Pause]
		Switch item=XbmcLiving_PlayPause label="Pause" icon="pause" mappings=[ON="Pause"] visibility=[XbmcLiving_State==Play]
		Switch item=XbmcLiving_Stop label="Stop" mappings=[ON="Stop"] visibility=[XbmcLiving_State==Play, XbmcLiving_State==Pause]
	}
}

It works for a short moment when I start the player, or put it to pause, and back to playing again, and in the log I found this.

2015-10-21 22:35:08 - XbmcLiving_State state updated to Play
2015-10-21 22:36:52 - XbmcLiving_State state updated to Stop
2015-10-21 22:36:52 - XbmcLiving_Title state updated to 
2015-10-21 22:36:52 - XbmcLiving_ShowTitle state updated to 

It never detect the title or show, and the player is still playing, but somehow it got detected as having stopped.

Anyone able to see if there is an error in the code I used? I guess the config for the player is correct, since it does notice the state change.

Ah,I also got a lot of this in the other log

2015-10-21 23:47:48.256 [ERROR] [enhab.binding.xbmc.rpc.RpcCall] - Error handling POST response from XBMC
org.openhab.binding.xbmc.rpc.RpcCall$RpcException: Failed to read JSON
	at org.openhab.binding.xbmc.rpc.RpcCall.readJson(RpcCall.java:95) ~[bundlefile:na]
	at org.openhab.binding.xbmc.rpc.RpcCall.access$0(RpcCall.java:84) ~[bundlefile:na]
	at org.openhab.binding.xbmc.rpc.RpcCall$1.onCompleted(RpcCall.java:122) ~[bundlefile:na]
	at org.openhab.binding.xbmc.rpc.RpcCall$1.onCompleted(RpcCall.java:1) ~[bundlefile:na]
	at com.ning.http.client.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:63) ~[async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyResponseFuture.getContent(NettyResponseFuture.java:292) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyResponseFuture.done(NettyResponseFuture.java:319) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.markAsDone(NettyAsyncHttpProvider.java:1521) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.finishUpdate(NettyAsyncHttpProvider.java:1543) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.access$2600(NettyAsyncHttpProvider.java:158) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider$HttpProtocol.handle(NettyAsyncHttpProvider.java:2188) [async-http-client-1.8.4.jar:na]
	at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.messageReceived(NettyAsyncHttpProvider.java:1220) [async-http-client-1.8.4.jar:na]
	at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.9.0.Final.jar:na]
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.9.0.Final.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: java.io.EOFException: No content to map to Object due to end of input
	at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2766) ~[jackson-mapper-asl-1.9.2.jar:1.9.2]
	at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2709) ~[jackson-mapper-asl-1.9.2.jar:1.9.2]
	at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854) ~[jackson-mapper-asl-1.9.2.jar:1.9.2]
	at org.openhab.binding.xbmc.rpc.RpcCall.readJson(RpcCall.java:89) ~[bundlefile:na]
	... 37 common frames omitted

Mikey, can I ask what you have in your openhab.cfg ? I’ve struggled to get openHAB to work at all with openelec… but if your settings work for me then I’ll see if I run into the same problem.

Dan

I added this

######################## XBMC Binding ###########################
# https://github.com/openhab/openhab/wiki/XBMC-Binding

# Hostname / IP address of your XBMC host
xbmc:bedroom.host=192.168.1.101

# Port number for the json rpc service (optional, defaults to 8080)
xbmc:bedroom.rsPort=80

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

# Username to connect to XBMC. (optional, defaults to none)
xbmc:bedroom.username=xbmc

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

Hi,

I have same problem, only Player.State works for a minute or two, I have never seen any other parameters (Title, Album, Volume, etc.)
Also having JSON parse errors
I have Kodi 16.1 @ Raspbian

Did You solve it somehow?

I didn’t - I ended up using the Harmony binding to - indirectly - achieve the same result

Ok. Thanks for info will try the same way

18.12.2016 11:42 “Dan” bot@community.openhab.org napisał(a):