Trying to figure out how to tie together all of the separate pieces of your home automation system? One nice link to have is to control XBMC from Tasker (the Android automation app). Why? (you might ask?) Well, if Tasker can make your XBMC media center play and pause (or other various actions), then that opens up a whole world of possibilities of events that can trigger that Tasker profile.
What is Tasker?
Tasker is one of the best apps you can get for Android if you like playing around with automation. As I’ve explained before, Tasker can automate almost anything on your Android phone. Plus, there are lots of apps that integrate nicely with Tasker. They let you set triggers based on something in the app, or let you send actions to the app.
Yeah, But Why Use Tasker in Home Automation?
Home automation is only as good as its user interface. Sure flipping a switch that does a lot more than turning on that light is pretty cool, but what if you don’t want to get up? What do you always have in arm’s reach? Your phone.
Or what if you want to tie in your phone to your home automation system to utilize location-based triggers? You’ll probably need to use Tasker.
For example, I have a Z-Wave alarm system that I want to be hassle free for me, so I set it up so that when my wife’s phone and my phone both leave my home’s wifi range, Tasker arms my alarm system. More on this in a future post.
But getting back on topic, there could be many reasons why someone would want to control XBMC from Tasker. It allows you to play, pause, or stop XBMC playback based any trigger from you phone. My favorite integration for this is using the AutoVoice Tasker plugin to use voice commands into my phone to play and pause XBMC. This is example that I am using in this guide below.
Regardless of how you intend to use it, most people would agree that linking separate automation systems together is always a good thing.
Ok, How Do I Control XBMC from Tasker?
First, you will need to purchase and install Tasker if you haven’t already.
Next, you need to install the Yatse app on your Android phone. I’ve written before about how Yatse is the best XBMC remote app. You will also need to purchase the Unlocker upgrade to use the Tasker integration feature.
Make sure to setup Yatse to successfully communicate with your XBMC.
Now that you have everything installed, create a profile in Tasker and choose what ever trigger event you want. For me, I chose “AutoVoice Recognize” and entered a command of “play”, but AutoVoice is yet another app you would need to purchase. For the sake of this guide, choose something simple like State > Orientation > Face Down.
It will then ask you to choose a Task or create one. Just create one by giving it a name like “Pause XBMC”. Add an action to that task. Choose “Send Intent”.
When it takes you to the settings for that action, enter the following in the Action field…
org.leetzone.android.yatsewidget.ACTION_MEDIA_COMMAND
Then, scroll down and enter the following in the Extra field…
org.leetzone.android.yatsewidget.EXTRA_STRING_PARAMS:playpause
Note from the comment:
Just a quick note that gave me a few minutes of headache, remember in the task (send intent) to change the TARGET: to “Service”. For me, it was one “Broadcast Receiver” as default, and did not work.
~ Thank to Walden for the tip!
When, you’re done, tap the back arrow in the top left corner to save it. Now back out of Tasker to put the new profile and task into effect.
Try It Out
Go ahead and test it by having something playing on XBMC and then put your phone face down on a table. If your XBMC pauses, you have succeeded! Congratulations! Now you can play around with different ways you want trigger your Tasker profile.
For a complete list of all intent codes you can send from Tasker to Yatse, click here for the API documentation.
Cool! What else can I do?
Check out some of my other step-by-step home automation guides…
Z-Wave Home Automation with Vera
Home Automation Using Tasker and Z-Wave
How to Control IR Devices with Z-Wave
Nice tutorial, but how would this work with the YATSE commands that are “Play Next Episode of Mad Men” for example. I’ve got the play pause working nicely but can’t seem to wrap my large head around how to have Tasker work with some of these other commands.
Walkities, if you look at the API documentation link that I provided in the post, you will see that there are only basic commands that a remote control would be able to do. There is nothing that directly interacts with your library data. There is no way to know if you even have Mad Men in your library, and it especially wouldn’t be able to know which episode would be next. But, I like the way you think!
Walkities, very nice find. That’s right, that Yatse can figure out what is the “most recent episode” since Yatse does in fact sync the Kodi library to the Android.
It actually ended up being easier then I thought It was just finding the right API call. I did make a tutorial on it on my site http://hotstickybun.com/tutorials/control-kodi-by-voice-with-tasker-and-yatse . Not sure how correct I am in terms of setup but it’s working pretty good on my end. Thanks for pointing me in the right direction though.
Hi, thanks for the guide! Just a quick note that gave me a few minutes of headache, remember in the task (send intent) to change the TARGET: to “Service”. For me, it was one “Broadcast Receiver” as default, and did not work.
I updated the post with your tip. Thanks!