VoxCommando
Help and Support (Using VoxCommando) => VoxCommando Basics and Core Features => Topic started by: Tom_G_2010 on December 24, 2020, 04:54:01 PM
-
So, I've had success creating some basic commands to turn lights on and off and to set their dimmer levels.
What I haven't been successful at is searching the wiki docs and youtube tutorials... I'm on the hunt for some examples of using logic.
Here's what I want to accomplish:
If {1} = red then set {2} to 100
elseIf {1} = green then set {2} to 50
elseIf {1} = blue then set {2} to 25
else set {2} to 10
and I'll use {2} to issue a hue change for an RGBW light
Is this possible and if so how or where might I find some documentation or a video tutorial?
Thanks!
Tom G>
-
Rather than an else-if, you could do consecutive logic blocks with the stop.macro action:
https://voxcommando.com/forum/index.php?topic=2910.msg24634#msg24634
That said, it's possible that using a value-phrase payloadXML table may be a better approach but I'm not quite clear on how the command is being executed.
For example, if you're issuing a voice command to say "Turn the lights {red,green,blue,white,purple}", then in the payload XML file (https://voxcommando.com/mediawiki/index.php?title=Payloads#More_on_Payload_XML)you'd have payload phrase {colour} --> payload value {x}.
In this case there would be no need for a logic block at all, but each colour would need to be defined, along the lines of:
red --> 100
green --> 50
blue --> 25
white --> 10
purple --> 10
-
Example voice command using payload XML value-phrase file:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.3.0.4-->
<command id="281" name="Turn the lights {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Replace actions with the ones you need.">
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>Turn the lights {PF.1}:</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.AddText</cmdType>
<params>
<param>Sending value {1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Turn the lights</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\rgb_lights.xml</payloadFromXML>
</command>
The payloadXML file is attached separately to this post (see paperclip icon below). You'll note in the command tree that the payloadxml rgb_lights.xml is stored in VC's payloads folder.
-
Thanks!!!
I'll dig into this after the festivities wind down. Any sooner and the WAF will plummet into negative numbers .
-
As a wife myself, I approve of your priorities.
In case it hasn't come up for you yet, to use command xml from the forum, just select the command text in the post, copy, and paste it into the command tree editor window.
https://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum
-
Thanks for the info! I now have it working using a payload XML list!
-
Glad that worked out for you. Enjoy!
-
Some steps have a way to do it. Try searching for a clip.