Kodi implementation

hello everyone! first i wanna to say thanks to everyone that constantly help beginners like me to solve every kind of problem! a very big thanks to everyone!

now i have a new project that at the moment is in standby from a long time because i haven’t found a good topic (maybe i missed?) on how to do this on openhab.
i would like to implement Kodi with openhab to use a folder rpository located on a network file server.
i just want to use the kodi interface on openhab to play songs/playlist located on a NAS on my home network.

can anyone help me on how to do this? openhab is installed on a raspberry pi, but i suppose this makes no difference…

thanks to anyone will help me in this new challenge :wink:

Did you read the documentation on the Kodi binding? Try that and then ask specific questions on something you cannot get to work.


yes i’ve already red the kodi binding, but i don’t understand which ip address to use to make the binding to point to.
in documentation it’s written:
“The Kodi thing requires the IP address of the device hosting your Kodi media center instance” but i have no instances of kodi…am i wrong? i suppose i need to install kodi on my raspberry and then install kodi binding on openhab. so, then in binding i have to set ip address of the raspberry where kodi is running on.
is it right? an you point me to the command to install kodi?


HI Ruben,

There are a number of apps out there that do Kodi remote control very well and are all very user friendly. What’s your reasoning behind wanting to create your own personnel app using openHAB. If your not that familiar with how to build openHAB as a solution then I fear your going to struggle.

To maybe help you further when I’m in front of my setup I’ll provide you with some sample information, such as THINGS, ITEMS and SITEMAPS.



You can install Kodi on OpenHabian like any other linux packages. I use that way, it will work.

After installing you can use the Kodi binding. Enable in Kodi to be reachable. Then you can use ‘localhost’ instead of the IP of your Raspberry.

However this is not closely related to openHab.

ok that’s what i meant. i only requested the procedure to manage kodi from openhab. then i will read binding info and try to learn on how to implement on my structure. maybe i’ve wrote my question in the wrong way. i just need to control via openhab my media library. maybe kodi is the right interface between openhab and my nas server.
i’ve installed kodi, i’m trying to configure it to point to my NAS shared folder. when i’ve finished this step i will try configure kodi binding to openhab to play my songs. maybe i will write here if i need help.
btw, yes if you have a working sample of sitemap, things and so on, i will try to learn from it :slight_smile:
thanks a lot

Yes, for playing media Kodi is one of the best (home made) solutions.
However the Kodi Binding is somewhat limited you usually only able to read info (curr played title etc) but only send a few commands, like play pause, stop, volume.
If you want to send specific commands to Kodi, like start a stream, you should use Kodis HTTP API and implement it manually in a rule

Ähm, … that is not true. You can play a stream using the playuri channel.

Sorry my bad, you’re right :slight_smile: I just gave a bad example, because few days ago, someone wanted to start an app on Kodi and send a command to that add-on. That’s what for example is not available through openHab.

As promised here’s some of my configuration, to give you an example;


Thing kodi:kodi:Master_Bedroom "Master Bedroom - Kodi" [ipAddress="", port=9090, httpPort=8080]


Switch Kitchen_mute     "Mute"                  { channel="kodi:kodi:Kitchen:mute" }
Dimmer Kitchen_volume   "Volume [%d]"           { channel="kodi:kodi:Kitchen:volume" }
Player Kitchen_control       "Control"               { channel="kodi:kodi:Kitchen:control" }
Switch Kitchen_stop          "Stop"                  { channel="kodi:kodi:Kitchen:stop" }
String Kitchen_title         "Title [%s]"       <video>            { channel="kodi:kodi:Kitchen:title" }
String Kitchen_showtitle     "Show title [%s]"       { channel="kodi:kodi:Kitchen:showtitle" }
String Kitchen_playuri       "PlayerURI"             { channel="kodi:kodi:Kitchen:playuri" }
String Kitchen_notification  "Notification"          { channel="kodi:kodi:Kitchen:shownotification" }
String Kitchen_mediatype     "Mediatype [%s]"        { channel="kodi:kodi:Kitchen:mediatype" }


sitemap Kitchen label="Kitchen"
        Frame label="Kodi - OSMC" {
                Text item=Kitchen_showtitle label="TV Show [%s]" visibility=[Kitchen_showtitle!=""]
                Text item=Kitchen_title label="Currently Playing [%s]" visibility=[Kitchen_control=="PLAY"]
                Switch item=Kitchen_mute label="Mute"  visibility=[Kitchen_control=="PLAY"]

I hope this helps you get a better understanding of the config.

@rkrisi Never mind. Your statement in general is okay because there are much more features available which are not supported by the binding. The reason for that is not that we cannot implement it but more or less that they did not match with openHAB concepts and/or strategies.

Yes, this is what I wanted to say :slight_smile: Thanks for the correction!

ok guys thanks to all for help. finally i’ve found the configuration quite right for me.
sitemap and items are okay, i had to use paperui to add thing because i had to insert username & password for kodi web…is there a way to add username & password in kodi binding things file?

second question: actually kodi is running on raspberry but audio is coming out from raspberry speaker, is it possible to make another output device? for example, if i have the raspberry with kodi in my bedroom, play music from the tablet located in kitchen,with songs coming out from tablet speaker?

OT: from kodi web interface i have “connection to server lost”. anyone faced this error? i’m not able to manage anything…

Not sure why you’d have a username & password setup on Kodi at home, but that’s personal choice really. If you can enter the username & password using the Paperui then you’ll be able to do the same for a text based Thing.

As for your second question; if you want the audio to come from the speaker of your tablet and not your Raspberry PI, just install Kodi on the tablet and do it that way. The only way you can use the speaker from the tablet is if you can either connect a cable between the two, output from the RPI and input to the tablet. Not sure I’ve see a tablet that will allow that sort of connection though. Or you could try and add a Bluetooth dongle to your RPI and pair it with the Tablet as that may work. Again though I’m not convinced it will.

If you could explain your logic behind how you want things setup that would help us all greatly, we’d then be able to point you in the right or maybe better direction.

Finally the error message you mention is usually associated with network connectivity between Kodi and it’s source, such as NAS share. If your using Wifi for networking then take a look at what channel your using and also scan to see how many other people around you are broadcasting. You may find that your just getting a great deal of clashing and will have to find a better channel to use. The alternative is to use a wired network.

thanks for all Garry, clear!
just for info, how can i set username & password from things file?

this is a bad news…i thought the kodi plugin was able to play music directly to end device, and not from raspi…so the plugin is an interface to manage play/stop/pause and so on?
any idea of another plugin that can play directly mp3 files from my nas server? i would like to have an interface on openhab that once specified a remote directory, it will play from device the entire mp3 list…

the error message is shown also from itself. i mean i’ve got a test environment where kodi is installed, and from the desktop of this test environment, when i launch browser and point to kodi web page on itself, i got the same error of connection lost. it’s really strange…


Which of these two setups do you have? The one top once has openHAB and the Kodi client installed on the same device (Raspberry PI).
The bottom one has openHAB installed on a separate device and the Kodi client installed on a Raspbery PI.

Let’s work out your architecture first and foremost. We’ll then be able to make more informed decisions and therefore offer you better support.

i’ve got openhab server+kodi server on the same machine (raspberry pi3)
then i have a qnap nas where i host music files.
then i would like to use a tablet with habpanel and (i wish) kodi interface to play from tablet the music library…

or another solution is the possibility to “see” my upnp twonky media device (NAS), but i don’t know if there is a way to discover e configure my twonky in openhab…

Thanks for this @rubenfuser. That’s how I thought you had it all setup.

You have to remember that Kodi is a client application. Which means it’s focused on using the local resources such as the display or sound card. If you want the sound to come from your tablet then my first suggestion would be to install Kodi on the tablet and configure the openHAB binding accordingly, all very possible. OpenHAB will then be a remote interface for you.
As I described above, an alternative would be to make a Bluetooth connection to your tablet from the Raspberry PI in a way that it thinks it’s an audio connection. Not straight forward at all as tablets are not usual designed to be remote speakers.
An more workable alternative would be to purchase a bluetooth/wifi speaker then configure the RaspberryPI to connect to that for it’s audio output. Must more straight forward. The added bonus being that you could then use the same speak as your audio sink in openHAB and user voice alerts.

Just to reaffirm essentially habpanel is a web browser and openHAB is the web server for it. I’m sure you there are some very clever people out there and can develop code that would redirect the audio, but definitely not something that can be achieved by making a configuration change.