1
RegEx (Regular Expressions) / Re: Hue Group status
« on: February 04, 2017, 09:03:05 AM »
Thanks James.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.9-->
<command id="1022" name="Turn {1} ON" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="80" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Hue.Raw.Get</cmdType>
<params>
<param>groups</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RegExTool.Open</cmdType>
<params>
<param>True</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExSingle</cmdType>
<params>
<param>"{1}":\s{.*?".*?"all_on":\s(.*?),</param>
<param>:</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{LastResult}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)==(B)</ifType>
<ifParams>{Match.1.1}&&True</ifParams>
<then>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>The {PF.1} is already on</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>Hue.Group</cmdType>
<params>
<param>{1}</param>
<param>"on":true</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>The {PF.1} has been turned on</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>Turn</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">huePayloads\groups.xml</payloadFromXML>
<phrase optional="true">lights</phrase>
<phrase>ON</phrase>
</command>
"name":\s"(.*?)" .*? "on":\s(true)
and picks up the name of group but extends till it finds "on":true
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.9-->
<command id="1007" name="Turn {1} light ON" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="80" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Hue.Raw.Get</cmdType>
<params>
<param>lights</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RegExTool.Open</cmdType>
<params>
<param>True</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExSingle</cmdType>
<params>
<param>"on":\strue .*? "name":\s"(.*?)"</param>
<param>:</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.MatchConcat</cmdType>
<params>
<param> | </param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)Contains(B)</ifType>
<ifParams>{LastResult}&&{PF.1}</ifParams>
<then>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>The {PF.1} is already on</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>Hue.Light</cmdType>
<params>
<param>{1}</param>
<param>"on":true</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>The {PF.1} has been turned on</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>Turn</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">huePayloads\lights.xml</payloadFromXML>
<phrase>ON</phrase>
</command>