XBMC Binding

I’m just getting started now with OH2 and struggling a little in where/how to set things up regarding the bindings and their cfg.

So… A fresh install of OH2 and my /conf/services/addons.cfg is still set for demo.

In the paper ui, under extensions/bindings, I installed the xbmc addon But now I really don’t know where to proceed. When I click on bindings, I do not see that listed. And I do not see any xbmc.cfg file in the conf/services folder.

Do I need to change the addons.cfg from demo to standard and manually list out the binding names? Or create a separate xbmc.cfg file?

Also… I’m sure someone has mentioned it. But perhaps beginning with OH2, should the binding name be changed from xbmc to Kodi?

I took a day to play with OH2, but I also couldn’t make heads or tails of this, I couldn’t get any of my bindings working except the dmx binding seemed to work out of the box. maybe try here

Looking at https://github.com/openhab/openhab/blob/master/features/openhab-addons/src/main/feature/feature.xml#L386, there is indeed no xbmc.cfg file defined to be created for this binding.

But then again looking at https://github.com/openhab/openhab/blob/master/distribution/openhabhome/configurations/openhab_default.cfg, there were no xmbc entries either. So it seems that this was missing since a while already.

I’d suggest to report this as a bug at https://github.com/openhab/openhab/issues

Meanwhile, you can simply create a xmbc.cfg entry yourself in conf/services with entries according to the XBMC wiki (but stripping off the “xbmc:” prefix on the parameters.

I created the bug report that the cfg file is not being generated when installing the binding.

And I have gone and manually added an xbmc.cfg file to my conf/services location as well as added my xbmc items and can confirm the binding is working.

But I did notice the paper ui does not show the ability to add any xbmc items and not sure if it suppose to or not. But by adding them manually to the items file and site map, I can confirm the binding does work.

No, the Paper UI does not know anything about 1.x add-ons apart from the fact that it supports installing them.
You have to keep using it as before with creating item files etc.
Thanks for testing, good to know that it works!

paul, can I see your xbmc.cfg and items file? Im tying to get this working too…

Sure.

I think you also need to ensure your the username and password within the ‘webserver’ in xbmc is set to match what you put in your config file.

I was also curious if there were any plans to possibly rename the binding to Kodi going forward?

This is my xbmc.cfg file. I believe all that is different from using it in OH1 is just removing xbmc: from the beginning of each item

# Hostname / IP address of your XBMC host
FamilyRoom.host=192.168.11.52

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

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

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

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

And these are the items

String    XbmcFamily_State		  "Family State [%s]"     	{ xbmc="<[#FamilyRoom|Player.State]" }
String    XbmcFamily_Title      "Family Title [%s]"       { xbmc="<[#FamilyRoom|Player.Title]" }
String    XbmcFamily_ShowTitle  "Family Show [%s]"      	{ xbmc="<[#FamilyRoom|Player.ShowTitle]" }
Switch    XbmcFamily_PlayPause  "Family Play/Pause"     	{ xbmc=">[#FamilyRoom|Player.PlayPause]", autoupdate="false" }
Switch    XbmcFamily_Stop       "Family Stop"		          { xbmc=">[#FamilyRoom|Player.Stop]", autoupdate="false" }
String    XbmcFamily_Notify     "Family Notify [%s]"     	{ xbmc="<[#FamilyRoom|GUI.ShowNotification]", autoupdate="false" }

And this is the sitemap

Frame label="XBMC Info" {
		Text item=XbmcFamily_State label="State [%s]"
		Text item=XbmcFamily_Title label="Title [%s]" visibility=[XbmcFamily_State==Play, XbmcFamily_State==Pause]
		Text item=XbmcFamily_ShowTitle label="Show [%s]" visibility=[XbmcFamily_State==Play, XbmcFamily_State==Pause]
		Switch item=XbmcFamily_PlayPause label="Play" icon="play" mappings=[ON="Play"] visibility=[XbmcFamily_State==Pause]
		Switch item=XbmcFamily_PlayPause label="Pause" icon="pause" mappings=[ON="Pause"] visibility=[XbmcFamily_State==Play]
		Switch item=XbmcFamily_Stop label="Stop" mappings=[ON="Stop"] visibility=[XbmcFamily_State==Play, XbmcFamily_State==Pause]
	}

I am also having trouble with the Kodi.

Have copied all the above, but the log file does not even mention it anywhere. There was no XMBC Binding as mentioned above, so I just added it manually to the openhab.cfg file. Is that right?

I did as Kai suggested and removed the xmbc prefix, and have done the settings etc inside of Kodi but getting nowhere with this.

Anyone got any more help or have done this recently and could show anything would be much appreciated.

Thanks.

Phil.

@philkent

Which version of OH are you using? For OH2, you need to enable the binding via the PaperUI. But OH2 currently does not create the cfg file, so you just need to create that separately.

But it works.

Hi Paul,
Am using OH1, only just noticed that this was for OH2. Been searching and reading so many different threads now that getting lost!

@philkent

For OH1, you need to add the binding to your addons folder, and then include that config information into your OH1 configuration file.

If your copying the above, you just need to modify it to by placing xmbc: in front of each parameter line item like:

xbmc:FamilyRoom.host=192.168.11.52

I assume your modifying the above IP address as well to where ever your xbmc/kodi is running?

Also, remember changes to a the configuration file in OH1 require a stop and restart of OH1 for them to take affect.

Hi @ptmuldoon,

Yep - Done all the above:

Followed the above and the xbmc binding guide.

Have altered the relevant settings inside Kodi to allow other programs etc.
Added the xbmc prefix in front of each.
modified the IP to where Kodi is running (Fire Stick).
Have run a apt-get update, upgrade and reboot after modifying.

It is not even attempting to connect, the Log File shows nothing, and even the txt log file is empty.

I am thinking it has to do something with the fact that the binding for xbmc is not on the .cfg file, would you think that could be a reason.
Kai mentioned it earlier, the fact that it was not on the current versions.

UPDATE: It’s part-working! Lol.

Not sure how or why - But last night was still nothing, but I just ran another reboot and upgrade and now its connected and working.
I am now able to stop whats playing - and it displayed the Title of the Radio Station / Track we had going - I used the Stop button and that stopped it.

Just trying to get it to play something now from within OH - But a huge improvement on where it was.

Any idea on how I use it to Navigate, or set it to come on etc? Can Pause, Play and Stop whats playing - But struggling to open or browse for something.

I can confirm that this is working for Kodi instance installed through Retropie on a Pi3. The only issue so far is some odd sitemap renderings, but have not spent any time on the sitemap other than quick setup for validation.

-tp

Hi… I understand that I am reviving an old topic.
I am beginning my journey with Openhab and I chose OpenHab2. I can’'t get the XBMC service to appear in PaperUI.
The binding version I installed through the paper UI is version 1.9.0 SNAPSHOT. Then I went into /opt/openhab2/conf/services and edited the xbmc.cfg file to look like this

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

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

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

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

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

#Refresh interval in ms (optional, defaults to 60000ms [1 minute])
refreshInterval=60000

I can access the Kodi at 192.168.1.7:8080 (not authentication needed) so, I have already tested with
livingroon.username=
and
livingroon.username=kodi

Then I have also restarted both systems (openelec and openhab running on different RPi)

What do I need to do to get this working?

PS: I haven’t figured out a sitemap yet (it’s still too complex for me) so, do I need to do something about the "livingroom"
Please help

1 Like

Most (probably all) of the legacy 1.9 bindings require you to manually create the items in your items file and then add them to a SiteMap. Below is are the XBMC items I have configured.

String    XbmcFamily_State		"Family State [%s]"     	{ xbmc="<[#FamilyRoom|Player.State]" }
String    XbmcFamily_Title      "Family Title [%s]"        	{ xbmc="<[#FamilyRoom|Player.Title]" }
String    XbmcFamily_ShowTitle  "Family Show [%s]"      	{ xbmc="<[#FamilyRoom|Player.ShowTitle]" }
Switch    XbmcFamily_PlayPause  "Family Play/Pause"     	{ xbmc=">[#FamilyRoom|Player.PlayPause]", autoupdate="false" }
Switch    XbmcFamily_Stop       "Family Stop"		        { xbmc=">[#FamilyRoom|Player.Stop]", autoupdate="false" }
String    XbmcFamily_Notify     "Family Notify [%s]"     	{ xbmc="<[#FamilyRoom|GUI.ShowNotification]", autoupdate="false" }

Hi, sorry for hijack, can someone tell me if this acction still works with latest version of this biding?

sendXbmcNotification(host, port, title, message, image, displayTime)

i cannot get it workin, this is my error:

An error occured during the script execution: The name ‘SendXbmcNotification(,,,)’ cannot be resolved to an item or type.

the way I do it is have an item like:

String kodi_notification "Kodi notification [%s]" 		{xbmc=">[#livingRoom|GUI.ShowNotification]"}

and then send a notification in a rule:

kodi_notification.postUpdate("lights have dimmed")