This weekend I took some time to review this thread, the wiki and the links/videos suggested. After my review I do have a better understanding of how Regex and payloads work in VC. That said, I still need a little help with drafting the number 3 command. First, let me say that after spending hours trying to formulate the correct syntax for the scrape command for getting the requested information from the ISY. I have learned that the URL
http://192.168.1.5/rest/nodes/{1}/ST is not recognized by the ISY as written. The ISY does not recognize the payload indicator {1} and "ST". Instead i have used
http://192.168.1.5/rest/status. This url gives me the status of all devices in the ISY. See the full results below.
<?xml version="1.0" encoding="UTF-8"?><nodes><node id="11 B3 8F 1"><property id="ST" value="154" formatted="77.00" uom="degrees" /><property id="CLIMD" value="2" formatted="Cool" uom="n/a" /><property id="CLISPC" value="154" formatted="77.00" uom="degrees" /><property id="CLISPH" value=" " formatted=" " uom="degrees"/><property id="CLIHUM" value="75" formatted="75.00" uom="%" /></node><node id="14 2E B1 1"><property id="ST" value=" " formatted=" " uom="on/off"/></node><node id="14 2E B1 2"><property id="ST" value=" " formatted=" " uom="on/off"/></node><node id="14 2E B1 3"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="17 53 DB 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="17 54 96 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="1B 6E 54 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="1B 71 A0 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="1B 80 D2 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="22 B2 82 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="24 99 A0 1"><property id="ST" value="0" formatted="Off" uom="%/on/off" /></node><node id="29 B9 D 1"><property id="ST" value="0" formatted="Off" uom="%/on/off" /></node><node id="2A 29 97 1"><property id="ST" value="0" formatted="Off" uom="%/on/off" /></node><node id="32 80 D2 1"><property id="ST" value="0" formatted="Off" uom="on/off" /></node><node id="C 7B 80 1"><property id="ST" value="0" formatted="Off" uom="%/on/off" /></node><node id="ZW003_1"><property id="ST" value="100" formatted="Locked" uom="11" /></node><node id="ZW014_1"><property id="ST" value="0" formatted="Off" uom="78" /></node><node id="ZW015_1"><property id="ST" value="0" formatted="Off" uom="78" /></node><node id="ZW016_1"><property id="ST" value="0" formatted="Off" uom="78" /></node></nodes>
To grab the information that I need for VC to report on I used the following Regex code:
node\sid="(.*?)"><property\sid="(.*?)"\svalue="(.*?)"\sformatted="(.*?)"
At this point everything appears to work ok until I get to my logic block. The results from the logic block that I have written only reports half of the information correctly. Here is what i have written so far:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="512" name="Device Status {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://192.168.1.5/rest/status</param>
<param>don</param>
<param>dond</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RegExTool.Open</cmdType>
<params>
<param>True</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegEx</cmdType>
<params>
<param>node\sid="(.*?)"><property\sid="(.*?)"\svalue="(.*?)"\sformatted="(.*?)"</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)Contains(B)</ifType>
<ifParams>{Match.1.4}&&{Match.1.4}</ifParams>
<then>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{PF.1} is currently {Match.1.4}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.SpeakSync</cmdType>
<params>
<param>{PF.1} is currently {Match.1.4}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else />
</if>
<action>
<cmdType />
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Is the, What is the</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="True" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\ISYNodeNames.xml</payloadFromXML>
<phrase>On Off , Status</phrase>
</command>
At the end of the day, VC reports the status of the device incorrectly when using the "what is the" kitchen main light (as written in the payload file) command. It will report back the first device status as indicated by the "{Match.1.4}"
How do I write the logic block so that it reports back the correct status for any device that I request that information for?
Also, while I know that i can write a command for each device individually I was just looking to save time by using a payload as suggestd.