Author Topic: Customized light effects: Philips Hue + MediaMonkey  (Read 7256 times)

0 Members and 2 Guests are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Customized light effects: Philips Hue + MediaMonkey
« Reply #15 on: May 13, 2015, 05:44:00 PM »
I decided to try recreating this command using no Python.  I think I managed to do it using a single command, with no Python, and it should not have a problem with the quotes any more because that error was introduced when trying to call the python function which didn't like the quotes.

Only this command is required, but you'll still need to have the payload file: huePayloads\PhHues.xml so that it can look up the colour names to get values for hue and saturation.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.5-->
<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, and album name to Python script. Stores the current Hue state first, so you can choose to restore lights to previous state after executing the hueTunes lighting change (I don't do that here.)">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>{1} {2} {3}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>(red|green|purple|yellow|blue|white|pink|orange|black)</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>PayloadXML.GetValue</cmdType>
        <params>
          <param>huePayloads\PhHues.xml</param>
          <param>{Match.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Hue.Group</cmdType>
        <params>
          <param>0</param>
          <param>"on":true, {LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Hue.Light</cmdType>
        <params>
          <param>{i}</param>
          <param>"on":true,"hue":{Rnd.1.65000},"bri":210,"sat":{Rnd.150.250}</param>
        </params>
        <cmdRepeat>3</cmdRepeat>
      </action>
    </else>
  </if>
  <event>MM.Playing</event>
</command>

Although I have no problem with using python scripts in VC, it always makes me happy when I can do it all in a regular macro!

OklahomaGreyBeard

  • Contributor
  • ***
  • Posts: 54
  • Karma: 3
    • View Profile
Re: Customized light effects: Philips Hue + MediaMonkey
« Reply #16 on: May 13, 2015, 06:57:05 PM »
Worked great for me. I changed the group to 3 for my lights and in my case had to change it to change the three lights individually rather than a loop because the lights are numbered 1,4,5 on the hub.

At this point I have 26 lights on this hub with only 9 of them actual hue full color lights. There's no reason to have the hallway lights turn on and purple when a song plays.  :biglaugh 

I have those as full color and use  motion detectors so if anyone gets up in the middle of the night for the bathroom, it turns on red as low as they will go so you can see but it doesn't kill your eyes and wake you up any more than you already are.  They also come in handy here in Oklahoma when my weather radio gets triggered for a storm or tornado and the external trigger now fires the Red Alert command in VC.