[RELEASE] Kodi for SmartThings BETA

smartapp_av
kodi
dth_av

(Joshua Lyon (SharpTools.io Dashboard)) #9

@diehllane and @jjslegacy can you guys open the SmartThings IDE and let me know what firmware version number your hub is reporting?

In the meantime, you can try changing if(canInstallLabs()) on around line 137 of the SmartApp to if(true) to override the check and see if the device discovery process works as expected for you.


(Jeffrey) #10

I have the latest hub version - it’s a known issue and my support ticket says they hope for a fix in the next 1-2 weeks - ugh (specificially this is broken: hasAllHubsOver - seems maybe it’s not broken for everyone)

I did the following to get around it:

private Boolean canInstallLabs()
{
//return hasAllHubsOver(“000.011.00603”)
return true
}


(Brian Diehl) #11

My firmware version is 000.014.00026

I tried your suggestion but now I just get the red banner for “You are not authorized to perform this operation”


(Jeffrey) #12

A quick bit of playing the pause/play toggle doesn’t seem to work quite right. If I pause it shows pause for a second and goes back to play but the video remains paused so the concept works just not the button


(Brian Diehl) #13

Awesome! This worked for me, too. I hadn’t gotten to the bottom of the code so I hadn’t seen that in there.


(John S) #14

Not that there’s anything wrong with multiple ways to do the same thing, but you could already use Kodi as a DLNA speaker, with this pair of app/device type:

I’ve been using that combo with Kodi for quite a while now.


(Jeffrey) #15

This is an app to control Kodi not play sound through it


(Joshua Lyon (SharpTools.io Dashboard)) #16

And to be able to react to events in Kodi. So you could use this with Rule Machine Advanced to start your favorite playlist triggered by something occurring in SmartThings. Or you could have SmartThings automatically dim on your lights when the movie is paused or change your hue bulbs to your favorite color to match the theme of your movie or music.


(Paul) #17

Hi Joshua

I’m installing and getting this error with the smartapp…Is it something I’m doing?

Thanks

No signature of method: script1454802474987978170545.metadata() is applicable for argument types: (script1454802474987978170545$_run_closure1) values: [script1454802474987978170545$_run_closure1@39d9bb92] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)


(John S) #18

[quote=“jjslegacy, post:15, topic:38305, full:true”]
This is an app to control Kodi not play sound through it
[/quote]Ok - similar but not identical. My bad. The DLNA device supports some controls (volume, pause/play/stop) and events, but not playlists.


(Joshua Lyon (SharpTools.io Dashboard)) #19

I tried out the DLNA device type tonight and it is very impressive! @Kristopher pointed me to the DLNA player when I was looking for the Media Transport Control icons (Sonos Play/Forward/Pause), but I never thought to try it out with Kodi! Looking through the DLNA code, I am using a lot of the same concepts as the DLNA player for discovery and eventing, but I’m using the built-in JSON-RPC end points from Kodi for more nuanced control and exposing additional attributes.

I’m still working on building out the capabilities, but here’s some documentation on what I have done so far:

https://github.com/iamcanadian2222/ST-Kodi/blob/master/CAPABILITIES.md

Having all the extra commands and attributes available in the device type is particularly useful for advanced integrations like Tasker/Widgets on Android or Rule Machine Expert Features where you could use some of the custom attributes or methods to achieve some really cool things.


(Joshua Lyon (SharpTools.io Dashboard)) #20

My bad! I had the links to the SmartApp and Device Type code backwards! I have corrected the first post - try it now!

PS. I guess that’s what I get for writing documentation at 1 AM!

I pushed an update tonight which includes:

  • Fix for the Play/Pause button reported by @jjslegacy
  • Added play/pause state to the tile in the main Things list
  • Cleaned up the message parsing section so it won’t react to non-JSON responses
  • Changed to schedule() which should be more stable than the recursive runIn() calls (and moved to SmartApp)

For the last bullet item around scheduling, which is a big one, after you update the Device and SmartApp code, if you have any existing Kodi devices, you will need to open the Kodi SmartApp in your My HomeSmartApps view and tap Done to kickoff the new scheduler.


(Brian Diehl) #21

Until Media Players are added as devices for Rule Machine, Expert Features aren’t possible. They don’t show up there yet (unless I’m doing something wrong).

I know they show up as Switches at least if I use the Callbacks code here instead of this one (but this one is much easier to implement on a Fire TV device)


(Joshua Lyon (SharpTools.io Dashboard)) #22

@diehllane I just pushed an update that enables the “switch” capability for this device type and maps the status of “Playing” to “on” and the other statuses to “off” (eg. Paused/Stopped).

Try it out and let me know if it works for you.

(Also, don’t miss the notes I just posted just above about the actions needed to enable the new scheduler. Note that you and @jjslegacy will have to modify the canInstallLabs() method again when you update the SmartApp)


(Brian Diehl) #23

Awesome. It is now showing up in Rule Machine as a Switch.

One thing I have going on is my Mute/Unmute is actually backwards.
It’s not a big deal, but not sure if it’s universal or just something weird with my setup.

EDIT: Confirming the mute/unmute reversal on 2 different Kodi media players - Fire TV and Windows 10 PC


(Joshua Lyon (SharpTools.io Dashboard)) #24

When the device is muted, the “Unmute” action will show up. When the device is unmuted, the “Mute” action will show up.


(Brian Diehl) #25

Okay. So it’s for the command, not current status?
That makes sense.


(Brian Diehl) #26

I have this working for Rule Machine with OFF being Pause and ON being Play, but only for the Windows client. Kodi on the Fire TV is not working for this.

I am playing files off a network share and Play/Pause work, but don’t trigger anything in Rule Machine. Mute/Unmute works, and Previous Track will go back to the beginning. Info, Home, Select, and all of the arrows work as well from the phone.

I used the same Triggered Rule from Rule Machine that works on my PC Kodi, just changing the Switch to the Fire TV Kodi. It may just be an Android/FireOS issue.

Anyone else able to test this on Android or FireOS?


(Meep Meep.....) #27

unable to install.

market place > my apps > kodi (formerly xbmc)
I would get a message " upgrade needed! " upgrage, to use ST labs, your hub should be completely up to date. to update you hub, acesss Location settings in the main menu choose update hub.

But these instructions do not apply as my hub is up to date.

From ST: What is the latest firmware version?
At the time of writing (Jan 21, 2016): Hub v2 000.014.00026 (14.26)


(Brian Diehl) #28

You can use the workaround provided by @jjslegacy from above.
In the IDE, scroll down to the bottom of the code (around line 480) and edit it so it looks like this:

private Boolean canInstallLabs()
{
//return hasAllHubsOver(“000.011.00603”)
return true
}