XBMC Automation with Smartthings

XBMC Automation with Smartthings

Let me start out by saying “I’ve learned so much from this site”. The developers and user community is just awesome. I browse the threads everyday, to the point of an addiction, but this stuff is just so cool to tinker with.

Well, here we go… I I figured out how to automate XBMC Play, Pause, and Stop functions in XBMC with Smartthings.

Prerequisites: XBMC ( I’m running Openelec), XBMC Add-on “ XBMC CallBacks” , Smartthings Endpoint Example.

I will not go into details about XBMC directories, installing add-ons, etc… for the sake of time

Here are the steps

You’ll need to create python scripts that execute the commands to hit the Endpoint URL for your devices.

I created scripts called Movie_Play.py, Movie_Pause.py, Movie_Resume.py and Movie_Stop.py
Place the scripts in a directory that is accessible from the XBMC file manager.
For Testing: I placed the scripts in the downloads directory for XBMC

The scripts will look like the following:

#!/usr/bin/python
import xbmc
import urllib2

urllib2.urlopen(‘Copy and Paste your URL from the Endpoint Example Here’)

Note: Make sure the scripts have execute permissions.

Example:
The Play script I created turns off the living room lights and turns on the back lamps. This is accomplished by copying the OFF URL for the living rooms lights and copying the ON URL for the back lamps. The Pause turns the living room lights back ON via the ON URL string and the Resume turns the lights back off via the OFF URL string.

  1. Now that we have the scripts created. We need to install the XBMC add-on called “XBMC Callbacks”. You can download the add-on from here - http://forum.xbmc.org/showthread.php?tid=151011
  2. Copy the zip file over to a XBMC directory.
  3. Go to the add-on section in XBMC and choose to install from Zip file.
  4. Go to enabled add-ons - then services - then XBMC callbacks
  5. Click Configure - Click the section that states “ Player starts” - point this to the script you created - Example: Movie_Play.py - then configure the other sections pause, resume, and stop by pointing those sections to your other scripts that were created.

Note: You will need to reboot XBMC for the service to start
7. After XBMC is back up, test the scripts out by playing a movie, then pause and resume to see if everything is working correctly.

2 Likes

dude. Thank you!!! I’ll try to get this setup later today, but I have been trying to find a solutions like this for a while.

This is awesome, thanks a lot @ammo8996!

im confuse how to make it work, Do you have those scripts to see how works?

Or can you create a you tube video?

Thanks.

Can you show me the script?

Hi,

I’ve mentioned this elsewhere, this looks like a great idea. I am considering moving over to Smarthings from Ninjablocks, but I love the interface between Ninjablocks and XBMC. I am able to dim the lights when a move plays, and raise them when I pause or stop the movie. With your scripts here, would I be able to do the same?

If you could let me know that would be great, as I’m not able to test it myself currently?

Thanks

Dan

Dannygee - did you get an answer to this outside of this thread? I am considering using st also but would love kodi integration (lights dim on pause etc)

cheers

I apologize for reviving an old thread here. I’m starting to get this setup and built out is there a way to have this only work with certain modes? For example I don’t want to turn on my lights in the middle of the day because well there’s no need to do that. Thanks.