Author Topic: Telldus Tellstick Light control from VoxCommando (no  (Read 12222 times)

0 Members and 1 Guest are viewing this topic.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Telldus Tellstick Light control from VoxCommando (no
« on: March 16, 2014, 08:29:30 PM »
Hi I'm a newbie here but I thought this group I knocked up to control my Tellstick from VoxCommando might be useful to others. It uses the tdtool.exe command line utility which is installed as part of the Telldus Command Center installation and therefore doesn't need to use eventGhost.

You will need to set your switches up in Telldus Command Center first. I use a naming convention of room then type. For example Bedroom Light or Lounge Lamps.

There are two commands in the tellstick group for voxCommando:
Discrete
This is triggered by saying turn {switch name from Telldus command center} on or off.  e.g. turn lounge lamps on. You will note I split the switch name into two payloads the room name and the switch type. I could have had a single payload with all the combinations but this saved typing. This command also writes the switch state to a file for use by the toggle command. I have also attached an event to this command to allow its triggering from other commands (for example I have a good night script that turns off lights in a timed sequence)

Toggle
this is triggered by saying {switch name from Telldus command center} please. This will toggle the named switch between on and off. It keeps track of the current state by writing to a file  called {switchname}.switchstate. I only have the simple tellstick which just sends messages so I can't check if anything else is controlling the lights so it is possible these might be out of synch but I can simply call the discrete command to put it back to a known state. This command includes TTS feedback of the action. I added the please as it seems impossible to get just the two payloads to recognise unless someone knows better - I would have liked to have said just "Bedroom Light" to toggle

Things you will need to edit:
If you use my convention of room name and type you will need to change the first payload in each command to include all your room names and the second to include all your types (in my case these are Light for overhead lights, Lamp and Lamps for table lamps but you could use this for any sort of switch not just lights - for example Turn Lounge Fan off).

Possible improvements
This works fine for me but with more complex lighting it might be a real pain to have to key in all the options. The tdtool utility has the ability to list all switches and one enhancement would be to read that file to generate the payloads.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name=" tellstick" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1399" name="Discrete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{1} {2} {3} &amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--{3}  "{1} {2}"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.WriteLine</cmdType>
      <cmdString>{1}{2}.lightstate&amp;&amp;{3}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>turn</phrase>
    <payloadList>lounge,bedroom,spareroom</payloadList>
    <payloadList>light,lamp,lamps</payloadList>
    <payloadList>on,off</payloadList>
    <event>tell.lights</event>
  </command>
  <command id="1417" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <cmdString>{1}{2}.lightstate</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>File.Read</cmdType>
          <cmdString>[1}{2}.lightstate</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <cmdString>{1}{2}.lightstate&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>turning</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;off</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--on "{1} {2}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <cmdString>{1}{2}.lightstate&amp;&amp;on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--off "{1} {2}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <cmdString>{1}{2}.lightstate&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <payloadList>lounge,bedroom,spare room</payloadList>
    <payloadList>light,lamp,lamps</payloadList>
    <phrase>please</phrase>
  </command>
</commandGroup>

I hope this helps. Loving this product.

Garry
(Editor FascinatingTech.com)

EDIT: see 4th post for a revised version using maps instead of files to store state data as suggested by James below.

EDIT: see 14th post for an enhanced version that gets the list of devices from telldus
« Last Edit: March 19, 2014, 09:04:59 PM by garryjw »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #1 on: March 16, 2014, 09:46:03 PM »
Hi Garry and welcome to the VC forum. 

Very nice first post!   ::bow

Being in North America I can't make use of a Tellstick but I hope some others will be able to get a leg up using your xml.

I can answer one or two of your questions, and maybe suggest something.

Yes, you must have at least one normal phrase in every command.  You can't just use payloads.  That is because payloads carry a value for the payload, but the phrases (well the first phrase anyway) carries the ID of the command which is used to find the macro which needs to be run when your voice command is recognized.  However, in the case of your toggle command, I think you might be able to replace your payloads with phrases and then use the {LastSpoken} variable, if you are careful.  The other option would be to break it up into multiple commands.  That said, longer command phrases are more reliable anyway (especially when you start to get a lot of commands in your tree) so adding the please at the end is good or what would be even better would be to put a "toggle" phrase at the beginning of your command, and then you could make the "please" phrase optional.

Also I can see that you are storing your light states with files.  This method works fine but I think you would be happier using maps.
http://voxcommando.com/mediawiki/index.php?title=Maps


I'm not too familiar with the syntax or the output of the tdtool.exe but if you have a lot of devices, you can probably use something like:
tdtool.exe --listdevices >> telstickdevices.txt

then from there you could create a payloadXML file by various methods depending on the output (either manual or automated).

Hope this helps.



garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #2 on: March 16, 2014, 10:59:21 PM »
Thanks James - great product and great fun to play with (I've been programming for more years than I care to remember - started with punch cards)

Yes maps make perfect sense - I had completely missed them - will rewrite with maps shortly.

I originally had a toggle command at the start of the toggle command but noticed house members kept forgetting to say it, although the politer ones were saying please which is why I used that. I can see why it makes sense to have a toggle phrase from the way voxCommando is implemented.

Your idea on switching the payloads to phrases for toggle will probably work very well for my limited number of rooms and devices - I will give it a go too.

Good guess on the tdtool syntax - almost spot on.

tdtool ---list gives
Quote
Number of devices: 5
1       Lounge Lamps    ON
2       Lounge Light    OFF
3       Bedroom Lamp    OFF
4       Bedroom Light   OFF
5       Spareroom Lamp  OFF
I'm sure I can find a way to parse that.


Anyway better say "computer good night" and get some sleep :-)

Thanks again
Garry
« Last Edit: March 16, 2014, 11:07:28 PM by garryjw »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #3 on: March 17, 2014, 09:44:00 AM »
Oh that's cool.  It actually gives you their current status (assuming the transmission from tellstick to the devices is 100% reliable)?

So you could read the file and parse it using results.regex and update your device state maps automatically, as well as generating a payloadXML automatically.

Of course if you only have 5 devices you can just make a payloadXML by hand.  You may want to do that and then you can make some aliases for the device names in case different people want to use different names for the same device.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #4 on: March 17, 2014, 12:15:33 PM »
Yes. Does look a good approach. I'm going to try the RegEx approach - must dig out my RegEx guide :-). In terms of using the Status from the --list command I wasn't sure how efficient it would be to read and parse that every time. I was thinking probably best to do it once at start up.

Here is the updated xml to use map instead of files for the status:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name=" tellstick" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1399" name="Discrete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{1} {2} {3} &amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--{3}  "{1} {2}"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>map.set</cmdType>
      <cmdString>switchstate&amp;&amp;{1}{2}&amp;&amp;{3}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>turn</phrase>
    <payloadList>lounge,bedroom,spareroom</payloadList>
    <payloadList>light,lamp,lamps</payloadList>
    <payloadList>on,off</payloadList>
    <event>tell.lights</event>
  </command>
  <command id="1417" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Map.Get</cmdType>
      <cmdString>switchstate&amp;&amp;{1}{2}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Map.CreateTable</cmdType>
          <cmdString>switchstate</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}{2}&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Get</cmdType>
          <cmdString>switchstate&amp;&amp;{1}{2}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>turning</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;off</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--on "{1} {2}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}{2}&amp;&amp;on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--off "{1} {2}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}{2}&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <payloadList>lounge,bedroom,spareroom</payloadList>
    <payloadList>light,lamp,lamps</payloadList>
    <phrase>please</phrase>
  </command>
</commandGroup>


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #5 on: March 17, 2014, 12:30:01 PM »
Nice.

Let us know if you need help with the regex.  I often use this cheatsheet: http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet

This might be of interest to you too: http://voxcommando.com/forum/index.php?topic=1446.0

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #6 on: March 17, 2014, 02:24:20 PM »
Thanks. Those v2 RegEx tweaks look really good.

Yes Mike's hint sheet is a great reference. Thanks for the pointer.

Are there any good examples of parsing a file to a payloadXML file in voxCommando. I can easily write a utility app to do it but would prefer to use the vox approach to make it more helpful for others.

Thanks again
Garry

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #7 on: March 17, 2014, 02:34:05 PM »
Yes, a recent example demonstrating 2 different methods can be found here: http://voxcommando.com/forum/index.php?topic=1136.msg12565#msg12565
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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #8 on: March 17, 2014, 04:28:12 PM »
For some reason I used scrape in that example to load the file.  You can just as easily use File.Read and you also don't need the file:// prefix.  I'm not really sure why I did that.  I guess I had been thinking in a "web zone" just before tackling that example.

If you get stuck and want help with this one, please attach the actual file generated by calling tdtool -- list
« Last Edit: March 17, 2014, 04:30:25 PM by jitterjames »

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #9 on: March 17, 2014, 04:49:33 PM »
Thanks again. I'm up for the challenge but if I get stuck I will post the output file.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #10 on: March 19, 2014, 12:12:37 PM »
Quick question what is the best/recommended way to launch tdtool.exe --list >> telstickdevices.txt. I tried passing --list >> telstickdevices.txt as the parameter to Launch.Hidden but not surprisingly that didn't work. I've currently resorted to a batch file but that seems a little clunky :-)

Thanks
Garry

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #11 on: March 19, 2014, 03:54:09 PM »
I'm not sure but you might have to use the batch file technique, if launch.rawparam doesn't work.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #12 on: March 19, 2014, 04:06:26 PM »
Thanks - no RawParam didn't work either. Batch file it is. Might be a useful future enhancement to get the output of a Launch command.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #13 on: March 19, 2014, 04:41:46 PM »
Agreed. :)

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #14 on: March 19, 2014, 09:03:12 PM »
Revised Group with  parsed list of devices
This revised version uses the tdtool.exe command line utility to get a list of the devices set up in teldus command center and their current status.

You will still need to set your switches up in Telldus Command Center first. I use a naming convention of room then type. For example Bedroom Light or Lounge Lamps but with this version you do not have to.

There are two new commands in the tellstick group for voxCommando:
DiscreteAlternative
This is triggered by saying turn on(or off) {switch name from Telldus command center}.  e.g. turn on lounge lamps. I added this because I kept saying it this way round rather than turn lounge lamps on. You will note this just triggers the original Discrete command passing in the parameters in the reversed order. I now only use two parameters the device name and the state(on or off) The parsing of the device names alleviates the need to separate room and type as there is no longer a need to worry about the amount of typing. On turning on or off the current state is stored to the devicestate map. This is used by the toggle command to check the current state and toggle appropriately.

list
this is triggered by saying Refresh Tellus Device but you could use an event to trigger it. This will run a batch file that will call the tdtool.exe with the --list parameter to generate a list of devices and their states. You will note I have not attached the batch file but the script will auto generate it the first time it is run. Once the list is generated it is parsed using regex and all the values added to the devicestate map. The device names are also output to a PayloadXML file which is then used as the payload for the Discrete and Toggle commands. This command has to be run at least once before any other tellus command can be used.

Possible Improvement
One further improvement would be to somehow autogenerate all lights on and all lights off commands.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name=" tellstick" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1505" name="Discrete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{1} {2}&amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--{2}  "{1}"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <cmdString>switchstate&amp;&amp;{1} &amp;&amp;{2}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>turn</phrase>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\tellusdevices.xml</payloadFromXML>
    <payloadList>on,off</payloadList>
    <event>tell.lights</event>
  </command>
  <command id="1503" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Map.Get</cmdType>
      <cmdString>switchstate&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Map.CreateTable</cmdType>
          <cmdString>switchstate</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Get</cmdType>
          <cmdString>switchstate&amp;&amp;{1}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>Reset</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>{LastResult} turning</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;off</ifParams>
      <then>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}&amp;&amp;on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>on</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--on "{1}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Map.Set</cmdType>
          <cmdString>switchstate&amp;&amp;{1}&amp;&amp;off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>off</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>C:\Program Files\Telldus\tdtool.exe&amp;&amp;--off "{1}"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\tellusdevices.xml</payloadFromXML>
    <phrase>please</phrase>
  </command>
  <command id="1557" name="List" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <cmdString>tellusgetlist.bat</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <cmdString>tellusgetlist.bat&amp;&amp;del telduslist.txt</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.AppendLine</cmdType>
          <cmdString>tellusgetlist.bat&amp;&amp;"C:\Program Files\Telldus\tdtool.exe" --list &gt;&gt;telduslist.txt</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <cmdString>tellusgetlist.bat</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <cmdString>payloads\tellusdevices.xml</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>PayloadXML.NewFile</cmdType>
          <cmdString>payloads\tellusdevices.xml</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType />
          <cmdString />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>Map.DropTable</cmdType>
      <cmdString>switchstate</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <cmdString>switchstate</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <cmdString>telduslist.txt</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>Parsing list of devices</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>(.*)\t(.*)\t(ON|OFF)\r</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <cmdString>switchstate&amp;&amp;{Match.{i}.2}&amp;&amp;{Match.{i}.3}&amp;&amp;True</cmdString>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <cmdString>payloads\tellusdevices.xml&amp;&amp;{Match.{i}.2}&amp;&amp;{Match.{i}.2}&amp;&amp;False</cmdString>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>Parsed {#M} devices</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Refresh Tellus Devices</phrase>
  </command>
  <command id="1409" name="DiscreteAlternative" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <cmdString>tell.lights&amp;&amp;{2}&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>turn</phrase>
    <payloadList>on,off</payloadList>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\tellusdevices.xml</payloadFromXML>
  </command>
</commandGroup>
« Last Edit: March 19, 2014, 09:06:54 PM by garryjw »