Send commands to Kodi with single buttons(like push buttons)

Hi All!

I installed OpenHAB2 and I’m configuring my sitemap and items to control some sonoff relays and a Kodi multimedia system.

The example shown in https://docs.openhab.org/addons/bindings/kodi/readme.html is to use:

Selection item=myKodi_input mappings=[Up='Up', Down='Down', Left='Left', Right='Right', Select='Select', Back='Back', Home='Home', ContextMenu='ContextMenu', Info='Info']

But using this code I have to click in the selection button and then choose an option(up, down, etc).

Instead of this, I want to put individual buttons for each use like this.

Sitemap:

Switch item=myKodi_up mappings=[Up='Up']

Items:

Switch myKodi_up "UP" {channel="kodi:kodi:myKodi:input"}

I tried this code, but it isn’t working.

Is there a way to do this? Maybe with rules and a SendCommnand function.

Thanks!

Hi Diego,

Please try to link a String item to the channel. I am pretty sure it will work with a Switch element in the sitemap like you already configured.

Hi, Christoph!

It worked. Thanks! Now I have Up, Down, Left, Right, Select and Back buttons working.

But I still have problems with Stop button. Stop only works like a switch. Tried to modify the item to String and map sitemap button to send an “ON” command, like instructions in this page https://www.openhab.org/v2.2/addons/bindings/kodi/#channels.

I also tried to use the channel channel=“kodi:kodi:myKodi:inputtext” and send the STOP command, but didn’t worked too.

Switch    item=myKodi_stop
Switch myKodi_stop   "STOP"     <"stop.png">			{channel="kodi:kodi:myKodi:stop"}

Do you have any idea?

Best regards!

Sounds good so far. Instead of creating different items for your Up/Down/Left/Right/… buttons you can reuse a single item linked to the input channel.

Items:

String myKodi_input {channel="kodi:kodi:myKodi:input"}
Switch myKodi_stop {channel="kodi:kodi:myKodi:stop"}

Sitemap:

Switch item=myKodi_input mappings=[Up="Up",Down="Down",Left="Left",Right="Right"]

or

Switch item=myKodi_input mappings=[Up="Up"]
Switch item=myKodi_input mappings=[Down="Down"]
...

My Stop button looks like this.

Switch item=myKodi_stop mappings=[ON="\u23F9"]