Kodi - Inputaction

Hi Community,
Am currently setting up my habpanel, and have multiple Kodi instances throughout my house. Ive noted that inputaction has now been implemented in the binding and wondered how one might go about launching addons using this feature? - Im hoping to have a selection item with a list of installed addons on my Kodi’s - I can not profess to be anything but a novice, and was hoping perhaps some wisdom in this area could be imparted :slight_smile: Thanks in advance :slight_smile:

Dear Matthew,

The inputaction channel uses a fixed list of valid commands. It is not possible to open a specific addon in the Kodi GUI with it.

I suggest to use the playfavorite channel for your purpose. You can add all addons to your favorites in Kodi. In some UIs (e.g. Paper UI or HABPanel) a Selection will be populated automatically with your list (see Open TV Channel in XBMC/Kodi).

cweitkamp’s suggestion is probably way easier but I’ve done something similar by using the jsonrpc:
(This is heavily modified from my version, I can’t guarantee it works)

Item

String myKodiAddonSelection "Select Kodi Addon" // this being the item you select on in the sitemap 

Sitemap

Selection item=myKodiAddonSelection icon="video" label="Kodi addon selection" mappings=[myAddon1="My addon 1",myAddon2="My addon 2" ]

Rules:

rule "kodi addon selection"
when
	Item myKodiAddonSelection received command
then
	var String mySelectedAddonId
	var String kodiUrl = 'http://username:password@<kodi-ip>:8080/jsonrpc?request='
	switch receivedCommand.toString {
		case 'myAddon1': mySelectedAddonId = 'plugin.myaddon1' // find the id of the addon (check addons xml file(s))
		case 'myAddon2': mySelectedAddonId = 'plugin.myaddon2' // find the id of the addon (check addons xml file(s))
	}
	var String content = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"' + mySelectedAddonId + '"},"id":"1"}}'
	sendHttpPostRequest(kodiUrl,'application/json',content)
end

Hi Christoph,

Many thanks, I went ahead and followed your instructions on one of my kodi instances, unfortunately I couldn’t get it to work. I can see the server populated favorite entries on my selection item on habpanel. On checking the logs i got the following;

2018-06-09 15:43:20.486 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query ‘OFFICETV_playfavorite’.

Hi Alpoy,

Thanks heaps for your assistance, Your method worked perfectly… Shall certainly make life easy implementing for all 9 of my kodi instances…

I needed to make a slight adjustment to the following section of the rule

sendHttpPostRequest(url,‘application/json’,content)

to

sendHttpPostRequest(kodiurl,‘application/json’,content)

I cant thank you enough for your help, am extremely grateful.

No problem, glad it worked for you :slightly_smiling_face:

(Fixed the kodiUrl typo)

I am happy to hear. What happens if you select on of the favorite entries in the selection?

I am afraid I cannot help you with this error as I am not an expert with mySQL persistence.