[OBSOLETE] [V 1.2] Kodi Manager - integrate and control Kodi with Smartthings

This is my attempt to try and get good control of Kodi via Smartthings, getting it integrated into the Smartthings echo system. It brings quite a bit of control.

Key Features

Communicate to and from Kodi
Get current state (Playing, Paused, Stopped, Shutdown, Startup)
Get current type - this is taken directly from Kodi
Get current category (Movie, TV Show, Sports)
All above configurable in preferences within the DTH
A fully functioning remote control right within your Smartthings App

Please take a look over at my GitHub README for the full details

##Version 1.2 [Latest]
Removed ‘Switch’ capability as doesn’t makes sense to me to use. Moved to Media Controller for the Kodi commands (Music Player still the state handler + custom attributes)

Made all the icons and colours a map at the very top of the code for easy customisation. Put in a easy to use order, so any future updates that override your personalisation are easy to copy and paste back over the update.

Install - You need to update both DTH and the Smartapp. If coming from a previous version, you MUST re-initalise the Smartapp. just go in to the smartapp (no need to change any settings) and click ‘Done’, for each smartapp instance. This will just re-initalise it to pick up latest settings.
NB you should not need to update the URLs in Kodi-Callbacks if you only update the smartapp to latest code.

Added more functionality to the remote and cleaned it up as a default theme (theme framework added for creating themes later)

Version 1.1 [Previous] - Overhaul of the original

I’ve turned the device handler into a media player and Kodi remote:

Preferences Screen

I’ve also added much better integration and control of Kodi. Head over to the read me for full details and comment below if you like it/have any suggestions/have any issues.

Version 1.0

I have forked and updated the Kodi Manager from here:

I’ve added shutdown and startup states. You need to add the URL’s to the callbacks plugin.

I’ve also added custom attributes and exposed some of the options I use as preferences in the device handler prefs.

Please take a look at the README in my repo for more info.

Also, I will be updating it, got quite a few ideas how I want to improve it. Eventually I’ll try and get rid off the call backs plugin (not sure I can do this!). For now its the best way to get the real time changes reflected

Special thanks to @toliver182 for the original kodi manager I forked.


Can you do this for two kodi’s? I have two boxes that I want to set up

@sosaudio1 Wow that was quick. Yeah you can have as many as you like. You install a new smartapp for each kodi. I have 2 (2 x RPi’s and 1 x AFTVS).

Nice! I have two boxes running Kodi and a couple ROKU’s that are rockin!!! Roku 3 uses WiFi to talk to the remote. That might be a neat set up to get ROKUs to run with SmartThings

Brilliant! I’ve been using the original version for a while. In my experience it’s very reliable on triggering the right state (kodi playing / stopped etc) in Smartthings. It would be excellent to have bilateral communication, e.g. Smartthings starting / pausing / stopping kodi, for instance if the home or smoke alarm went on. Is that possible? I’ll definitely switch to your version tonite. Many thanks

@Antongiulio_la_cort1 I actually thought this already did that but having now looked, I see you are right it doesn’t. I haven’t really used the smartapp, all I have done with it is change the code in the background of it to allow the DTH to do what I want.

I don’t plan on making the smartapp do more, I prefer to use CoRE for automation, it would take me years to give that kind of flexibility to the kodi smartapp. I’d prefer to remove the smartapp automation and just have a better DTH and better CoRE integration.

Getting back to your question though:
I have already added ‘shutdown’, I use this to shut it down when I leave, I have my RPi set up to turn my TV off, therefore turning off the TV when I leave the house.
I am currently working on a better way of handling commands to kodi. This will provide what you are looking for, it should allow you to do anything with kodi.

I will hopefully have a beta of that ready today/tomorrow. As its a fundamental change to how the DTH interacts with kodi, I’ll create a beta branch for some people to have a play with, leaving master in a working and stable state.

Just gonna need people to help test it!

Fantastic. Looking forward to trying it out.

@Antongiulio_la_cort1 Beta released. Let me know what you think

I’ll test it this morning. I take it I can just update the device handler I
previously had, or do I need to delete and reinstall everything (device
handler, smart app)?

@Antongiulio_la_cort1 you should be able to just update. But both smartapp and device handler

Really really good work! I was still running on the old version by @toliver182 so I initially had to remove the smart app and that removed the existing device from ‘Things’ too. All clean. I then installed both your beta and stable versions. They are working really nice on Android, apart from the selection area (up/down/left/right) which is not responding on kodi. A few more controls would fully complete my preferred user experience, if they can be achieved: (i) back 30 seconds in the traditional Netflix style, (ii) fast forward, (iii) fast rewind. At the moment here the back button is making the film/episode restart but the forward button is having no effect. Huge thanks.

I have also noticed that the Shutdown command when executed on my MacBook tries to shutdown the whole machine, not only kodi :slight_smile:

Thanks for the info

The directions and shutdown are weird.

Arrows - if everything else is working it’s odd that they dont work. What version of kodi you running?

Shutdown - again a little odd. Not used it on a Mac but it’s a direct command to kodi not the Mac. But then if that’s just a Linux port it could be running the system shutdown. I’ll add a ‘quit’ option for these instances.

Will take a look next time I get chance to get in the code.

Let me actually check all versions on my ST IDE, once I get back home tonite. I was thinking that maybe in the final test round I was running your beta device handler with the stable version smart app (mixed versions then). That should solve the Arrows issue. The ‘quit’ option you mentioned would still be useful, as well as your thoughts on the other commands I suggested (rewind/forward), which for me would be required pretty much every single time I’m watching something. Your new release is amazing and finally working bidirectionally :)) Many thanks.

FYI I’m running Kodi 17.0-RC3 (Jan 2017) on OS X 10.10.5. On my Kodi I can see both the ‘Exit’ command (this should correspond to your ‘quit’ option) and the ‘Shutdown System’ command (perhaps you are calling this one), which are available for selection once I click on the power on/off control button in the Kodi home window. As part of the same menu I can also see ‘Custom shutdown timer’, ‘Suspend’ and ‘Reboot’.

Ahh yeah if you are running stable smartapp that would explain it. The back end for commands won’t be there.

OK shutdown is the same as RPi then, full system shutdown, which is what I actually want to turn my TV off. I’ll add and option to change that.

As for the other bits. Will have a look when I get chance. Can see how easy or difficult it is till I can get back to the code base (just on my phone right now)

Never written smartthings or groovy before so still learning

Appreciate the feedback and help testing. Great work!

@Antongiulio_la_cort1 new beta release:

Note the line:
Also added new preference:
Shutdown as Quit - If you change this to true the shutdown command will quit Kodi instead of shutting down system :slight_smile:

The label on the button wont update (giving up now, will fix later) but let me know if the functionality works

Also made skip buttons ffwd and rwd instead (I can’t add more buttons, smartthings restrict that type of tile), so I will add more of my own later in the lower ui. Need to sort icons anyway

A few other updates - feedback welcome

Just update both smartapp and device handler

1 Like

All good apart from the ‘quit’ command that now is not working on my side (I selected Shutdown as Quit). No effect if I click that button. The rest is impressive, I really like the rewind/forward functionality, especially because hitting the button repeatedly changes the speed of cueing. Amazing work! I agree, better icons would complete the work :)) I personally don’t like bright red colours either (stop and quit buttons) but I can always sort it out once everything is stable, with a light “personalised” amend in the code. Thank you very much!

Yeah that’s what I get for rushing… Try it now. Label still not fixed but functionality should be

All working. I am playing with the icons now.