Set/Read Current TV Channel from Openhab to Kodi

Hey all,

I am unable to determine which channel is currently played.
Also, i can not set the Channel with a command.

This one works:

String KodiLiving_OpenMedia    	"Kodi Player file [%s]"  	{xbmc=">[#Livingroom|Player.Open]"}
String	KodiLiving_Title	"Titel [%s] "			{xbmc="<[#Livingroom|Player.Title]"}

Those don’t work

String KodiLiving_OpenTVChannel "Open TV Channel [%s]"  	{xbmc=">[#Livingroom|PVR.OpenTV]"}
String	KodiLiving_PVR_Channel	"Test [%s] "			{xbmc="<[#Livingroom|PVR.Details.Channel]"}
String	KodiLiving_PVR_Channel_2"Test [%s] "			{xbmc="<[#Livingroom|PVR.GetChannelDetails]"}

Thank You in advance

Same problem here …

It used to work with an old version of KODI

1 Like

The weird thing is, that KORE (Remote from an Android Phone) shows the correct item.
Name of the TV Station and, if provided the current Movie.
Maybe this should be raised on GitHub.

I use the ‘Player’ object to get information about what’s playing in Kodi:

String XBMC_Playing                     "XBMC Speelt nu: [%s]"                                          { xbmc="<[#woonkamer|Player.Title]" }
String XBMC_Label                       "XBMC Label: [%s]"                                              { xbmc="<[#woonkamer|Player.Label]" }
String XBMC_PlayerStatus                "XBMC Player Status: [%s]"                                      { xbmc="<[#woonkamer|Player.State]" }
String XBMC_PlayerType                  "XBMC Player Type: [%s]"                                        { xbmc="<[#woonkamer|Player.Type]" }

‘Label’ shows the PVR channel, while ‘Title’ shows the actual show (as far as Kodi is aware of it).

Thanks, i managed to get the Information i want by using a rule.
Now only the Radio Station is not configured Properly.
I want to get the Station, followed by the Artist / Song Name.
The information is provided by Kodi.
See the “Song Test” Entry below.
(Unknown Media Type=Radio Station(M3U)
For example a german radio station:
http://www.wdr.de/wdrlive/media/einslive.m3u

Rules

rule "Print Song,Artist,Station and/or Title" when Item KodiLiving_Title changed or Item KodiLiving_Station changed or Item KodiLiving_Artist changed then if(KodiLiving_Type.state.toString=="song"){ KodiLiving_Song.postUpdate(KodiLiving_Artist.state.toString +" - "+ KodiLiving_Title.state.toString)} if(KodiLiving_Type.state.toString=="channel"){ KodiLiving_Channel.postUpdate(KodiLiving_Station.state.toString +" - "+ KodiLiving_Title.state.toString)} end

Not working: (M3U Radio Station+Title)
if(KodiLiving_Type.state.toString=="unknown"){ KodiLiving_Unknown.postUpdate(KodiLiving_Station.state.toString +" - "+ "song TEST")}

Items:

Group 	gKodi 					"Kodi Mediacenter Items"	
String	KodiLiving_Player		"Status [%s]"				(gKodi)			{xbmc="<[#Livingroom|Player.State]"}
String	KodiLiving_Type			"Typ [%s] "					(gKodi)			{xbmc="<[#Livingroom|Player.Type]"}
String	KodiLiving_Title		"Titel [%s] "				(gKodi)			{xbmc="<[#Livingroom|Player.Title]"}
String	KodiLiving_ShowTitle	"Titel [%s] "				(gKodi)			{xbmc="<[#Livingroom|Player.ShowTitle]"}
String	KodiLiving_Artist		"Artist [%s] "				(gKodi)			{xbmc="<[#Livingroom|Player.Artist]"}
String	KodiLiving_Station		"Station [%s] "				(gKodi)			{xbmc="<[#Livingroom|Player.Label]"}
String	KodiLiving_Song			"Artist + Song [%s] "		(gKodi)
String	KodiLiving_Channel		"Station + Title [%s] "		(gKodi)
String	KodiLiving_Unknown		"Radio + Title [%s] "		(gKodi)

sitemap:

Frame label="Mediacenter" visibility=[Kodi==ON] {Text item=KodiLiving_Song label="[%s]" visibility=[KodiLiving_Type==song] Text item=KodiLiving_Title label="[%s]" visibility=[KodiLiving_Type==movie] Text item=KodiLiving_Channel label="[%s]" visibility=[KodiLiving_Type==channel] Text item=KodiLiving_Unknown label="[%s]" visibility=[KodiLiving_Type==unknown]}