Cannot get text data from Kodi (title, send notifications etc.)

Hi,
I have a kodi binding via paperui (all is on latest stable, oh2.2) and commands work fine like volume, play/pause, but textual items do not show neither in paperui nor when I add items manually.
In logs I see item changing when I change it, but it immediately changes back to UNDEF

2017-12-28 23:10:25.948 [vent.ItemStateChangedEvent] - myKodi_notification changed from NULL to MyValue
2017-12-28 23:10:25.957 [vent.ItemStateChangedEvent] - myKodi_notification changed from MyValue to UNDEF

In paperUi it only shows a dash “-” next to the values.
Same happens if I add item manually like

String myKodi_title “Title [%s]” { channel=“kodi:kodi:5d7a4ae8:title” }

then in sitemap i have
Text item=myKodi_title

same thing in log files.

I couldn’t google anything, any clues where I can start debugging?
Should I perhaps uninstall binding from paperui and manually add it via config files, would I have a bit more control that way?
Thanks!

Hi Dalibor,

for the shownotification channel it’s the expected behavior. You can send a String to it which will be displayed in the Kodi GUI. After that it is set to UNDEF again. The channels title, album, etc. are only populated with data while watching a movie or listening to music. Otherwise they are set to UNDEF too.

Please have a look at http://docs.openhab.org/administration/logging.html for more information about debugging.

Thanks. I Just tested now and all seems to work fine. It looks like Kodi has some bug with local media and title is not set for local media, and notifications have 15s delay. All works fine when i play some radio. But it is a Kodi thing, nothing with a binding to do.

Do you perhaps have a example of how to play some uri on Kodi, for example a YouTube video of a playlist?
I would like to play some music when certain rules trigger
Thank you again for the help

Sounds cool.

Of course. Just send an URI to the channel in a rule. I don’t know if a YouTube video works. Please try it and keep my posted.

demo.items

String kodiLivingRoomPlayerOpenMedia "Play URI" {
    channel="kodi:kodi:AAAAAAAA:playuri"
}

demo.rules

...
    kodiLivingRoomPlayerOpenMedia.sendCommand("http://www.wdr.de/wdrlive/media/einslivedigi.m3u")
...

I guess it is possible to use a Selection item in a sitemap as well:

demo.sitemap

...
   Selection item=kodiLivingRoomPlayerOpenMedia mappings=["1LIVE diggi"="http://www.wdr.de/wdrlive/media/einslivedigi.m3u"]
...

Thank you very much, it helped a lot. It works with url you provided (works in mappings as well, although link is on the left and name on the right).

It doesn’t work with youtube link directly, I’ve found on the web that a plugin should be called as a command, with payload containing youtube video id, something like (untested)

{“jsonrpc”: “2.0”, “method”: “Player.Open”, “params”:{ “item” : {“file” : “plugin://plugin.video.youtube/?action=play_video&videoid=pZwVga-Hr9Q” }}, “id”: 1}

I suppose a systemcommand should be used for this kind of “raw” commands (?)
I will try this after the holidays.

I just tested a direct call to kodi http api from chrome and it works, so that could be a valid workaround.
This is what I pasted in chrome browser if anyone needs it (it is encoded payload from above)

http://192.168.1.2:8080/jsonrpc?request=%7B%22jsonrpc%22%3A+%222.0%22%2C+%22method%22%3A+%22Player.Open%22%2C+%22params%22%3A%7B+%22item%22+%3A+%7B%22file%22+%3A+%22plugin%3A%2F%2Fplugin.video.youtube%2F%3Faction%3Dplay_video%26videoid%3Dl-sZyfFX4F0%22+%7D%7D%2C+%22id%22%3A+1%7D