Author Topic: Any Philips Hue users here?  (Read 29665 times)

0 Members and 3 Guests are viewing this topic.

Casmo

  • $upporter
  • Contributor
  • *****
  • Posts: 85
  • Karma: 0
    • View Profile
Re: Any Philips Hue users here?
« Reply #30 on: March 15, 2014, 11:09:23 AM »
Oh I've also noticed this:

"Brightness of the light. This is a scale from the minimum brightness the light is capable of, 0, to the maximum capable brightness, 255. Note a brightness of 0 is not off "

So presumably it cant be changed by %

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #31 on: March 15, 2014, 11:11:21 AM »
Can you please post the xml that you're using in a code block? That is, for each command that you're having problems with, please post the xml that is currently in your command tree.
 http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum#Posting_Your_Code_to_the_Forum

And if you're using payload xml files for those commands, please attach those too.

If changing brightness to 0 doesn't turn a light off in Hue syntax, then probably a separate lights off command will be needed.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Casmo

  • $upporter
  • Contributor
  • *****
  • Posts: 85
  • Karma: 0
    • View Profile
Re: Any Philips Hue users here?
« Reply #32 on: March 15, 2014, 11:18:19 AM »
Oh the zero doesn't mean off is not an issue, i was more referring to the range of 1 - 255

The code i used is as per posted by kalle

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="704" name="dim Hue" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>File.Write</cmdType>
    <cmdString>{Path.VC}\huetest.bat&amp;&amp;{1} {3}{2}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.OpenBat</cmdType>
    <cmdString>{Path.VC}\huetest.bat</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>I have dim {1} to {2} percent</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>dim</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\hueID.xml</payloadFromXML>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\huecolor.xml</payloadFromXML>
  <phrase optional="true">to</phrase>
  <payloadRange>1,100</payloadRange>
  <phrase optional="true">percent</phrase>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #33 on: March 15, 2014, 11:26:46 AM »
OK. And you've made no changes to his xml and you're using the payload xml files he posted as is?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Casmo

  • $upporter
  • Contributor
  • *****
  • Posts: 85
  • Karma: 0
    • View Profile
Re: Any Philips Hue users here?
« Reply #34 on: March 15, 2014, 11:31:34 AM »
Thats right, using the code exactly as posted. I changed bulb names in the hueid xml as I had misnamed them and added a few colors to the huecolors ml but that is all. 

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #35 on: March 15, 2014, 11:53:31 AM »
On the change scene one, its appears to be only changing the first light e.g. light 3 below

hue lights 2 blue{CR}hue lights 1 mediumturquoise{CR}hue lights 3 dodgerblue

Sounds like it is only executing the last line then. It's hard to know what you mean when you say that you tested these "work in a batch file". What do you mean when you say that they work?

The dim command doesnt appear to be working correctly either. I've been working through how the commands
are built, on this one im not sure why the huecolors xml is being called. When executed the TTS is saying for example "kitchen light dimmed by blue %" (though it doesnt actually dim)   

The TTS announcement is not actually checking to see whether the earlier actions have been executed, it is just stating that "I have dim {1} to {2} percent". A TTS announcement can't do anything other than talk.

Take a look at the dim Hue command in your tree, or in the xml that you posted for me. Which payload is payload 1, and which payload is payload 2?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #36 on: March 15, 2014, 12:02:29 PM »
The dim command should not be using the hue colour payload xml.

Based on Kalle's description of how the command is supposed to work, I suspect that he meant to use a different payload xml file there but forgot to change that line and provide you with the necessary payload file. But since it's not my xml I will leave that to you guys to figure out.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #37 on: March 15, 2014, 12:13:59 PM »

"Brightness of the light. This is a scale from the minimum brightness the light is capable of, 0, to the maximum capable brightness, 255. Note a brightness of 0 is not off "

So presumably it cant be changed by %

Although the command uses the phrase "percent", that's just talk. In the end, we're using the syntax that the developers provided. So you could either do some math and figure out how you might change the scale of 0 to 255 to percentages and then have a payload xml file do the conversion for you, or map a set of values from 0 to 255 to phrases in your payload xml (e.g value "0" to phrase "lowest setting" 110 = "medium bright" 255="maximum brightness). Or you simply use a command like "dim light X to 255" / "dim light X to 0" as your way of telling it to go to maximum brightness or the dimmest setting.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Any Philips Hue users here?
« Reply #38 on: March 15, 2014, 12:40:32 PM »
nime is right, I've changed something in the payloads and forget to upload it - so sorry  :bonk

Here is the command group again and also all changed payloads.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="hue test new" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="690" name="change hue colours" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Write</cmdType>
      <cmdString>{Path.VC}\huetest.bat&amp;&amp;{1} {2}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenBat</cmdType>
      <cmdString>{Path.VC}\huetest.bat</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>I have set the {1} to colour {2}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>switch, put, turn</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\hueID.xml</payloadFromXML>
    <phrase optional="true">to</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\huecolor.xml</payloadFromXML>
  </command>
  <command id="691" name="hue scenes" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Write</cmdType>
      <cmdString>{Path.VC}\huetest.bat&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenBat</cmdType>
      <cmdString>{Path.VC}\huetest.bat</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>I have set the hue to {PF.1} scheme</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>hue scheme</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\hueScene.xml</payloadFromXML>
  </command>
  <command id="704" name="dim Hue" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Write</cmdType>
      <cmdString>{Path.VC}\huetest.bat&amp;&amp;{1} {3}{2}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenBat</cmdType>
      <cmdString>{Path.VC}\huetest.bat</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>I have dim {1} to {3} percent</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>dim</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\hueID.xml</payloadFromXML>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\huecolor.xml</payloadFromXML>
    <phrase optional="true">to</phrase>
    <payloadRange>1,100</payloadRange>
    <phrase optional="true">percent</phrase>
  </command>
</commandGroup>
« Last Edit: March 16, 2014, 10:51:41 AM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #39 on: March 15, 2014, 12:56:53 PM »
Hi Kalle,

Sorry to add to the confusion!  :bonk

The command I am not understanding is specifically the "dim Hue" command.

The Hue documentation gives the example syntax:
Code: [Select]
hue lights 1 -10
In the xml you've posted, I am seeing the following:
Code: [Select]
Dim {lightID} {light colour} {range 1 to 100}
Why is there a light colour payload in this command?

Also, Casmo has noticed that Hue does not calculate brightness by percentage (0% to 100%), but from 0 (dimmest) to 255 (brightest).

So, when they say "-10" or "+10", they mean incrementing between 0 and 255, not percentages.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Any Philips Hue users here?
« Reply #40 on: March 15, 2014, 03:15:41 PM »
Please take a look in the xml, there is also a up/down include (I know the name huecolor.xml is a bit confuse), sorry for that  ::)
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Any Philips Hue users here?
« Reply #41 on: March 15, 2014, 03:37:27 PM »
Ahh. I get it. Thanks Kalle.

But then, shouldn't the payloads in action:
Code: [Select]
<action actiontype="File.Write" repeat="1" logic="False"><paramstring>{Path.VC}\huetest.bat&amp;&amp;{1} {3}{2}</paramstring></action>
be ordered {1} {2}{3} ?

The payload range in {3} is obviously not a big deal -- Casmo can just change that from 0 to 255 and delete the phrase "percent".

[Edit: if he wants to increase or decrease, then I guess not 0 to 255, but whatever range makes sense that is not percent-based. Increase by 10, 20, 50, 100, 150, 200 -- whatever, since 120 is approximately 50% brightness etc.]
« Last Edit: March 15, 2014, 04:25:54 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Any Philips Hue users here?
« Reply #42 on: March 15, 2014, 06:19:00 PM »
Yes my fault, {1} {3}{2} is correct.
I think Casmo can use a bit python math to have the brightness in percent, that is not a big deal.  ;)
« Last Edit: March 16, 2014, 10:52:56 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Any Philips Hue users here?
« Reply #43 on: March 16, 2014, 01:29:12 PM »
Yes my fault, {1} {3}{2} is correct.
I think Casmo can use a bit python math to have the brightness in percent, that is not a big deal.  ;)

The simplest solution for brightness would be to have your brightness range be from 0 to 25, and of course don't use the word "percent".

Then you can set the brightness parameter using: {1}0

So if you say set brightness 25 it will be set it to 250

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Any Philips Hue users here?
« Reply #44 on: March 28, 2014, 02:20:40 PM »
by the way I found a way to do this with no batch file at all.

You just need to use launch.rawparam and run cmd.exe with the correct params.

So if you would normally use this on the command line:
Code: [Select]
hue lights 1 red
you could use launch.RawParam.  For the path you use
Code: [Select]
C:\Windows\System32\cmd.exeand for the parameter you use
Code: [Select]
/c hue lights 1 red
I have also added Scrape.Put action to the latest version of VC2 so in theory now everything can be done using the hue api directly.  I don't have any way to test it though.