Does anyone have Kodi connected to Hubitat?


#1

We use Kodi rather than Plex for our main media centre PC.
With ST I was able to set rules that if a movie was playing I could set certain lighting etc..
This was done using the following GitHub - joshualyon/ST-Kodi: Kodi for SmartThings - Device Type and SmartApp for ST

I was wondering if anyone has a way of doing similar in Hubitat as I'm trying to get the last few things off ST?


#2

Do you have Harmony?
I set mine based on the Harmony activity in use.


#3

I do and I have that set currently but with ST I was able to use the attached SmartApp / Device to set Movie lighting when we watch a movie using the following options in WebCore

image

I may keep ST anyway once I fully migrate across as I think there are a few things that aren't going to work in Hubitat currently


#4

Which are you using Phil? I see a couple on ST forum.


#5

This is the one I was using that the tracktype reporting works on


#6

Kodi has an exposed API (https://kodi.wiki/view/JSON-RPC_API/v9) that can be called using websockets. You could write a simple app (or driver, perhaps) that could subscribe to the websocket and report when a player has started playing a media item and then inspect the returned JSON and grab the media type.


#7

I used to use this with Insteon. It's just http get, so you could use it as an example.

http://www.smarthome.com.au/smarthome-blog/xbmc-insteon-add-on/


#8

Looks like I need to learn how to write an App / Driver then!

Where to start lol...

Haven't ever done anything like this so will take a while to get my head around it.


#9

Did you try just porting? You can remove the tiles from the driver code, they are not used on HE. Change occurrences of physicalgraph to hubitat in the code.


#10

I did on the one Kodi for ST Beta, I sorted the physicalgraph references and was able to get to save but was then throwing up errors so I played around with some stuff and made it worse so would have to start again :slight_smile:


#11

If you haven’t already, post what the errors are and someone here should be able to help you sort it out.


#12

With the help of Roy over PM we have been able to get the App and Driver to install and I have then been able to get the driver to pause / play etc. But it isn't reading the state of the playing media.

I have got it to work by overriding the auto-discovery as this doesn't find my devices.

The error I'm getting is groovy.lang.MissingMethodException: No signature of method: user_app_boshdirect_Kodi__formerly_XBMC__195.parseLanMessage() is applicable for argument types: (java.lang.String, java.lang.Boolean) values: [mac:XXXXXXX, networkAddress:C0A801B4, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-0017882d484c, ssdpTerm:urn:schemas-upnp-org:device:basic:1, ssdpNTS:, ...] on line 257 (onLocation)

Line 257 onwards is " def lanEvent = parseLanMessage(evt.description, true)" and is in the group as follows:

/**

  • Called when location has changed, contains information from

  • network transactions. See deviceDiscovery() for where it is

  • registered.

  • @param evt Holds event information
    */
    def onLocation(evt) {
    // Convert the event into something we can use
    def lanEvent = parseLanMessage(evt.description, true)
    lanEvent << ["hub":evt?.hubId]

    //log.debug "LAN EVENT: ${lanEvent}"

    // Determine what we need to do...
    if ( lanEvent?.ssdpTerm?.contains(getDeviceType()) )
    {
    parseSSDP(lanEvent)
    }
    else if (
    lanEvent.headers && lanEvent.body &&
    lanEvent.headers."content-type".contains("xml")
    )
    {
    def xmlData = new XmlSlurper().parseText(lanEvent.body)
    parseDESC(xmlData)
    }
    }


#13

I used the same device type handler from Joshua in ST as well. I've never coded in groovy before, but I am willing to help, test, or any other way I can to keep this rolling. I would like to port this over too. This and alarmdotcom are my last integrations running on ST.


#14

Can you post the driver and app here?