I've been playing with our Philips Hue lights for the holidays. This is a variation on some commands I shared a while back, in which the lights changed colour to match song data.
In my Christmas command sequence, I have the Hue lights changing to red, green, and white/silver when a Christmas song plays in MediaMonkey.
It does this by first creating a new Hue scene called VC01 (storing the previous state first). The same command loads the python script. This happens when VC is first launched.
When a new song starts playing, I grab the song title, artist, album name, and genre and pass that to my Python script. The script evaluates whether any of the data contains one of my Xmas keywords. If so, it triggers my Xmas light scene.
Then, every 30 seconds, as long as the Xmas song keeps playing, VC will rotate the sequence of lights left (Hue.RotateLeft).
If a non-Xmas song plays, it will restore my Philips Hue lights to their original, pre-Xmas scene state.
I think this could be done with XBMC or other media players as well. If anyone is interested in adapting this for those programs and would like some feedback or advice, let me know. I'd be happy to help figure it out with you.
UPDATE: See post later in this thread for a better version -- which does *not* need the Python plugin but does the same thing.This command group contains 5 commands. You'll need to put the attached python script in the \PY folder of your VC directory as well.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.8-->
<commandGroup open="True" name="XMAS music effects" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="292" name="++Colour trigger" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Passes song title, artist name, album name, and genre of current song to Python script. Stores the current Hue state first.">
<action>
<cmdType>MM.currentsongdata</cmdType>
<params>
<param>Genre</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>hueXmas("{1}","{2}","{3}","{LastResult}")</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>MM.Playing</event>
</command>
<command id="265" name="Load python, create Xmas light scene" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Create Xmas Scene using 3 Hue lights. Load python script.">
<action>
<cmdType>Hue.Store</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Hue.Light</cmdType>
<params>
<param>1</param>
<param>"on":true, "hue":65535 ,"bri":254 ,"sat":254</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Hue.Light</cmdType>
<params>
<param>2</param>
<param>"on":true, "hue":24637 ,"bri":88 ,"sat":254</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Hue.Light</cmdType>
<params>
<param>3</param>
<param>"on":true, "sat":80, "hue":37500</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Hue.Scene.Create</cmdType>
<params>
<param>VC01</param>
<param>VC01</param>
<param>1,2,3</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Hue.Restore</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecFile</cmdType>
<params>
<param>PY\hueXmas.py</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>VC.Loaded</event>
</command>
<command id="246" name="++Switch on Xmas light scene" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Hue.Scene.Load</cmdType>
<params>
<param>VC01</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.SetEventTimer</cmdType>
<params>
<param>30s</param>
<param>rotateLights</param>
<param>{var.nowPlaying}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>Hue.XmasLights</event>
</command>
<command id="248" name="Rotate lights" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>MM.currentsongdata</cmdType>
<params>
<param>Title</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)==(B)</ifType>
<ifParams>{LastResult}&&{var.nowPlaying}</ifParams>
<then>
<action>
<cmdType>Hue.RotateLeft</cmdType>
<params>
<param>1,2,3</param>
<param>10</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.SetEventTimer</cmdType>
<params>
<param>30s</param>
<param>rotateLights</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else />
</if>
<event>rotateLights</event>
</command>
<command id="262" name="Restore previous light settings" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Hue.Restore</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>nowPlaying</param>
<param>null</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>MM.TrackEnd</event>
<event>MM.Stopped</event>
</command>
</commandGroup>
Of course, you can choose your own light colours, song keywords, and how often the lights rotate. The colours are set in the command "Load python, create Xmas light scene". The keywords are defined in the Python script. The light rotation timing is determined by the VC.SetEventTimer actions, which occur in 2 different commands.
Enjoy!