XBMCState has been replaced? Superseded? by a new Vera and Kodi add-on called KodiRemote. KodiRemote is based off XBMCState however it also now has playback transport controls and navigational buttons, so you can control Kodi from the Vera web UI.
You should now install KodiRemote rather than XBMCState so follow the new setup guide here.
END OF UPDATE
Those of you who read my blog regular, will know I have been using Windows Media Center and the mControl Home Automation add-in for controlling my Micasaverde VeraLite Z-wave gateway. If not you can take a peek here.
It works well and I can control and view the status of lights, door & motion sensors, IP cameras and run scenes in Vera from the Windows Media Center UI on the TV.
I am currently working on migrating away from Windows Media Center to XBMC running on Linux Ubuntu and one of the biggest things I will miss in XBMC is this type of integration with my Vera Home Automation system.
What I am going to write about today is no where near as advanced as what I have setup in Windows Media Center, however its a good starting point and I am going to demonstration some basic Vera / XBMC integration using the new XBMCState add-on.
What I am going to setup is so the lights in my Living room automatically brighten up to 100% if I stop or pause Video playback in XBMC and when I start or resume Video playback in XBMC the lights automatically dim down to 25%.
As of writing today the XBMCState add-on is not in the Mios App store properly so you need to download and install it manually, if you are reading this much later then you will probably find it in the Mios app store by then.
Introduction: From the developer..
1. Install the XBMCState plugin from the mios app store (take note of your Vera IP and XBMCState device ID)
2. Install the XBMC addon from the zip file below. (If you use safari, be careful cause it automatically unzip the file and XBMC give some error to install it)
3. Go to the add-on setting and put the Vera IP, XBMCState device ID, put yes to all the event that you are interested in.
4. RESTART XBMC. When you change the IP address and ID device you absolutely have to restart XBMC to take affect.
6. Try it out.
For now these event are triggered:
Music and video title of the file that is actually played is also showed.
There also now a debug mode that show what is send to Vera in the log file if activate.
Tested on Frodo
Windows = OK
Linux = OK
Mac = OK
Raspberry = OK
Install the XBMCState Vera add-on from the mIOS apps page here
This should create a new XBMCState device in Vera under the Devices tab (no room)
Click the Spanner on this device go to the Advanced tab and make a note of the Device ID number.
You can change the name: field from XBMCState to something meaningful like XBMC – Lounge or XBMC – Bedroom etc. I will come back to this later as you need to add an IP address as well.
Download the Zip file for the XBMC add-on here save it to some where your XBMC PC can access. Go in to XBMC and go to System – Settings – Add-ons. Select Install from zip file
Browse to the zip file and the add-on will be installed and enabled
Now from System – Settings – Add-ons, select Enabled Add-ons
Right click the Micasaverde XBMC event item and select Configure
Insert the IP address of your Vera unit and enter the Device ID number of the XBMCState device in Vera.
XBMC state tab
Player state tab
Here you can select the different events that can happen in XBMC and that the XBMCState device in Vera will detect. I have selected Yes on the following Video playback states. Click OK and reboot the XBMC PC.
Go back to Vera and configure the new XBMCState device, go to the Advanced tab, I changed the name to XBMC – Lounge and enter the static IP address of your XBMC PC. Assign the device to a room. Save the changes and Reload Vera.
Now we can test its working? start playing a Video in XBMC.
The XBMCState Device status in Vera should say:
- Computer: Up
- Player: Video_start
Pause the Video playback in XBMC, the player status should change to Video_pause
This tells us that the XBMC add-on is successfully communicating with Vera.
Now we just need to add some triggers to our lighting scenes so the lights can be controlled via the Video playback status of XBMC.
In Vera I created two new scenes, you might be able to just use some of your existing scenes
XBMC – Lounge On (Scene)
So in my Lounge I have two lamps I want to be turned on when Video playback in XBMC is stopped or paused, so I just clicked both of these lamps to be on in the scene.
Next go to the Triggers tab of the scene
I added two new triggers one for Video Stopped and one for Video Paused
Video Stopped trigger
Device = Select your XBMCState device in this case #53 XBMC – Lounge
What type of event is the trigger? = Player State Changes
Name for this Trigger = Video Stopped
Player State = Video is Stopped
Now repeat this and recreate the second trigger for Video Paused.
Now we only want this to happen if its night time, you don’t want your lights coming on and off with video playback in XBMC if its day time. So for both of the triggers you just setup you need to click in to each Luup Event button
And paste in this is_night code:
if ( luup.is_night() ) then
Click the Save Lua button – then Confirm changes and save in Vera etc.
XBMC – Lounge Dim 25% (Scene)
Now we need to setup the scene that dims down the lights when Video playback in XBMC is Started or Resumed. Its the same as the above but your triggers are slightly different.
Set your lights to dim to the desired percentage
Again I have two triggers but this time for Video Resumed and Video Starting
Video Resumed trigger
Video Starting trigger
Again you need to click the Luup Event buttons on each trigger and add in the is_night code as before.
Save all that in Vera and Reload.
Now at night time when you start or resume video playback in XBMC your lights should auto dim down and when you stop or pause video playback the lights will brighten up.
More than one XBMC PC ?
If you have multiple XBMC PCs you can simply create more XBMCState devices in Vera, to do this go to the Apps tab in Vera scroll down and find the XBMCState app click It.
Click create another.
Obviously you will need to install the XBMCState add-on in to XBMC on those other XBMC PCs.
This is revision one of this guide so things maybe updated and changed as the XBMCState Vera / XBMC add-ons are further developed.
This is certainty not mControl in Windows Media Center but its definitely a first step in the right direction and thanks to the developers I am feeling slightly happier about the test Linux / XBMC PC that is sat in my living room, now that the lights can be controlled with XBMC Video playback!