Author Topic: Telldus Tellstick Light control from VoxCommando (no  (Read 12234 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 »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #15 on: March 19, 2014, 10:21:19 PM »
Thanks for the updated xml.  It looks like it is getting interesting!  I will try to find time tomorrow to look at this properly and also to address the issues with V2 maps get/set.  One thing I found is that if you access map values using the variable format {M:mapname.key} instead of using the Map.Get action, the subsequent call of Map.Set does not cause VC to freeze.

I will be adding a Launch.Capture action to Version 2 as well (to read console output from launched programs) but I have other changes in the works so I won't be able to release an update for a while.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #16 on: March 20, 2014, 05:10:23 PM »
Thanks James. I've tried replacing the Map.Get with a {M:mapname.key} reference but for me it is still freezing.

One thing I did mean to ask. I really wanted to convert my ON|OFF match in the regex to lower case but I couldn't find a regex code that worked  (I'm assuming your using .net behind the scenes) Is there a tolower equivalent in VC.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #17 on: March 20, 2014, 06:10:45 PM »
Yeah, I've been banging my head against this one all day.  The code is identical from VC1 to VC2 so the only difference is that VC2 is using .Net 4 and that means I had to change the sqlite dll that I'm using.  I guess there is a bug in the wrapper.  It is claiming that the database is locked when we try to do the write but I am 100% sure that I am not leaving the connection open.  I am still trying to figure out a work-around for this.

I don't really understand your question about lower-case though...  We do have actions (Results.Replace and Results.RegExReplace that you could use to modify last result, though I'm not sure why it matters.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="1618" name="replace on off lowercase" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>ON OFF</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <cmdString>ON&amp;&amp;On</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <cmdString>OFF&amp;&amp;Off</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #18 on: March 20, 2014, 08:24:49 PM »
Thanks again. Those sort of problems can be really tricky and annoying especially when its not your code (I spent the morning trying to debug DirectShow so I feel your pain)

On the lowercase it is purely cosmetic (well audio cosmetic) the voice I'm using pronounces all capital words as individual letters. I'll try to see what I can do with Results.Replace.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #19 on: March 20, 2014, 08:58:45 PM »
That is certainly a good reason.  Python to the rescue!

You can just use .lower()

Here's an example.  All that is required is that the python plugin be enabled.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="169" name="python lowercase" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PY.ExecString</cmdType>
    <cmdString>result="HAHAHA.hoHoHo!".lower()</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

It is unfortunately not practical to have an action for every little thing like this so python is really perfect to handle all the "extra" stuff.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #20 on: March 28, 2014, 01:11:53 PM »
I have posted an update to Version 2 which includes the Launch.Capture action

http://voxcommando.com/forum/index.php?topic=1443.msg12499#msg12499

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #21 on: March 28, 2014, 08:33:30 PM »
Thanks James - that is really useful. I will update my script.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #22 on: March 28, 2014, 08:47:37 PM »
The get/set of maps should be working normally too, without freezing.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #23 on: March 28, 2014, 09:07:36 PM »
Works really well and yes the freezing has gone - what was that in the end?

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<commandGroup open="True" name=" tellstick" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1515" name="Discrete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{1} {2}</param>
        <param>1000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{2}  "{1}"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>{1} </param>
        <param>{2}</param>
      </params>
      <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="1531" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>switchstate</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <params>
        <param>result="{LastResult}".lower()</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Map.CreateTable</cmdType>
          <params>
            <param>switchstate</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Get</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Reset</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <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>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>C:\Program Files\Telldus\tdtool.exe</param>
            <param>--on "{1}"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Map.Set</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>C:\Program Files\Telldus\tdtool.exe</param>
            <param>--off "{1}"</param>
          </params>
          <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="1541" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>OK switching</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Var.lights}&amp;&amp;on</ifParams>
      <then>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>lights</param>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>lights</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{Var.lights} "Lounge Light"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{Var.lights} "Lounge Lamps"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>Lounge Light</param>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>Lounge Lamps</param>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Lights</phrase>
  </command>
  <command id="1567" name="List" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>tellusgetlist.bat</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
            <param>del telduslist.txt</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.AppendLine</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
            <param>"C:\Program Files\Telldus\tdtool.exe" --list &gt;&gt;telduslist.txt</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <params>
        <param>payloads\tellusdevices.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>PayloadXML.NewFile</cmdType>
          <params>
            <param>payloads\tellusdevices.xml</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType />
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>Map.DropTable</cmdType>
      <params>
        <param>switchstate</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>switchstate</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>telduslist.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Parsing list of devices</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(.*)\t(.*)\t(ON|OFF)\r</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>{Match.{i}.2}</param>
        <param>{Match.{i}.3}</param>
        <param>True</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <params>
        <param>payloads\tellusdevices.xml</param>
        <param>{Match.{i}.2}</param>
        <param>{Match.{i}.2}</param>
        <param>False</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Parsed {#M} devices</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Refresh Tellus Devices</phrase>
  </command>
  <command id="1419" name="DiscreteAlternative" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>tell.lights</param>
        <param>{2}</param>
        <param>{1}</param>
      </params>
      <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>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #24 on: March 29, 2014, 07:08:11 PM »
I never really figured out what the cause was, but I knew it was related to the connection to the database so I rewrote all my connection handling to use a completely different approach.  Originally I was using static methods to perform sql queries.  Each of those calls would open a new connection, perform the query, and then close and destroy the connection.  All calls were being made from the same thread and employed a "using" block so there should not have been a problem, and with .net 3.5 there wasn't.

Luckily you don't need to know the reason for the problem in order to find a solution.  You just need to try something new.

My solution was to use an object (no static calls) that maintained an open connection to the database.  It was a lot of rewriting and of course it created some new challenges (based on the availability of that object to different areas of the program) but it worked, and it probably means that it is faster now since it isn't opening and closing the database for each action.  The only possible downside is that perhaps if VC crashed hard the database would think it was still open, but I'm trying not to think about that too much...

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #25 on: March 29, 2014, 07:57:37 PM »
Never pays to think too much :-) I can't really think why swapping from a static method should have made a difference but the class approach definitely has advantages on speed.

It is definitely quicker. I used to notice (on V1) a distinct pause between the text spoken before the map write and  that afterward - not noticeable now on V2.


maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #26 on: March 24, 2018, 10:36:08 AM »
Hi garryjw,

i'm trying to use your xml file to control my light with Tellstick but it's not working for me! can you help me out please?

Thank you.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #27 on: March 24, 2018, 11:21:29 AM »
Hi maxwel,

I don't know that Garry is still alerted to new forum posts.

I can't really help you because I don't have a Telldus stick and you have not described your setup or what steps you followed. However I just wanted to say that Garry's solution would have been for older Telldus products -- specifically, I think, the Tellstick Classic and Tellstick Duo.

He is using the Telldus commandline tool tdtool.exe, which came with the TelldusCenter software at the time (http://telldus.com/resources/).

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.

Are you using one of those older Tellsticks and do you have that software installed and set up with your Tellstick?
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)

maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #28 on: March 24, 2018, 01:35:58 PM »
Hallo nime5ter,

thank you for responding to my request, i am using the older Tellesticks, specifically, the Tellstick Classic and the software Tellduscenter is already installed. tellstick is also ready set up. i was trying to use the last xml file but i dont really know what i need to edit.

Merci for any help

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #29 on: March 24, 2018, 02:02:30 PM »
i was trying to use the last xml file but i dont really know what i need to edit.

What do you mean by "last xml file"? Can you please link to the forum post that contains the xml you are trying to use?

No matter which of Garry's Telldus command groups you imported, there are two main things you need to do for them to work:

1. Set up and create meaningful names for your devices in the Tellduscenter software.
2. In VoxCommando, execute the Telldus command called "List". (The voice command to execute that command is "Refresh Telldus devices".)

That is the command that will generate the payloadXML file with your device names as well as a separate map table that stores the state of each of your switches (e.g. is it ON or OFF).

Garry's other commands rely on the payloadXML and the map table.

In short:

Once you have Telldus set up as required, you should see if you can successfully execute the List command without errors.

Then you can look in the "switchstate" file in the Maps editor as well as at the payloadXML file that was generated (telldux.xml) to see if they display your device information.

If those look OK, the other commands should hopefully work for you.

If you see errors in your VC History window (orange lines), then roll over the line with your mouse to see what the error message is. You can also find the error message in your log file, if you have logging enabled in VC.
« Last Edit: March 24, 2018, 02:09:21 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)

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #30 on: March 24, 2018, 03:44:00 PM »
Good summary Nimestar (although I would expect no less).

I don't use tells any more so I haven't really looked at this script in a while

One thing to check is that you can send commands that work from Telldus Command Center

maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #31 on: March 24, 2018, 05:10:56 PM »
What do you mean by "last xml file"? Can you please link to the forum post that contains the xml you are trying to use?

hi Nimester, I was trying to use this code but no succes
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<commandGroup open="True" name=" tellstick" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1515" name="Discrete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{1} {2}</param>
        <param>1000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{2}  "{1}"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>{1} </param>
        <param>{2}</param>
      </params>
      <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="1531" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>switchstate</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <params>
        <param>result="{LastResult}".lower()</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Map.CreateTable</cmdType>
          <params>
            <param>switchstate</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Get</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Reset</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <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>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>C:\Program Files\Telldus\tdtool.exe</param>
            <param>--on "{1}"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Map.Set</cmdType>
          <params>
            <param>switchstate</param>
            <param>{1}</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>C:\Program Files\Telldus\tdtool.exe</param>
            <param>--off "{1}"</param>
          </params>
          <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="1541" name="Toggle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>OK switching</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Var.lights}&amp;&amp;on</ifParams>
      <then>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>lights</param>
            <param>on</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>lights</param>
            <param>off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{Var.lights} "Lounge Light"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>C:\Program Files\Telldus\tdtool.exe</param>
        <param>--{Var.lights} "Lounge Lamps"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>Lounge Light</param>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>Lounge Lamps</param>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Var.lights}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Lights</phrase>
  </command>
  <command id="1567" name="List" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Launch.Hidden</cmdType>
      <params>
        <param>tellusgetlist.bat</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>File.WriteLine</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
            <param>del telduslist.txt</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.AppendLine</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
            <param>"C:\Program Files\Telldus\tdtool.exe" --list &gt;&gt;telduslist.txt</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Launch.Hidden</cmdType>
          <params>
            <param>tellusgetlist.bat</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <params>
        <param>payloads\tellusdevices.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>PayloadXML.NewFile</cmdType>
          <params>
            <param>payloads\tellusdevices.xml</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType />
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>Map.DropTable</cmdType>
      <params>
        <param>switchstate</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>switchstate</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>telduslist.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Parsing list of devices</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(.*)\t(.*)\t(ON|OFF)\r</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>switchstate</param>
        <param>{Match.{i}.2}</param>
        <param>{Match.{i}.3}</param>
        <param>True</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <params>
        <param>payloads\tellusdevices.xml</param>
        <param>{Match.{i}.2}</param>
        <param>{Match.{i}.2}</param>
        <param>False</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Parsed {#M} devices</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Refresh Tellus Devices</phrase>
  </command>
  <command id="1419" name="DiscreteAlternative" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>tell.lights</param>
        <param>{2}</param>
        <param>{1}</param>
      </params>
      <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 24, 2018, 05:23:44 PM by nime5ter »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #32 on: March 24, 2018, 05:30:36 PM »
I'm sorry but that is not enough information for me to help you.

You will need to explain exactly what you tried to do, and what kinds of error messages you are receiving. There is no other way we can help you.

For example:

1. I imported the command xml.
2. I saved and closed the command tree.
3. I executed the "List" command by saying "Refresh Tellus devices"
4. VoxCommando understood me and seemed to execute the command, but I see orange error messages in the History window and when I look at the telldus.xml payload XML file it is empty.
5. I enabled logging in VoxCommando and executed the "List" command again.
6. I have attached my log file to this post.

http://voxcommando.com/mediawiki/index.php?title=Log

NOTE: If it is difficult for you to write in English, please feel free to write in your own language. It is more important that you explain exactly what you are doing and what is happening. We can use Google Translate to read your explanation.
« Last Edit: March 24, 2018, 05:33:03 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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #33 on: March 24, 2018, 06:51:15 PM »
One thing to check is that you can send commands that work from Telldus Command Center

Also: Garry's suggestion is the first step.

If you can successfully send Telldus commands from the Telldus Command Center software, please confirm that this is working in your next post.
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)

maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #34 on: March 25, 2018, 10:31:44 AM »
Good morning Nimester,

I will try to give more detail and sorry for my bad english! I speak Dutch.
what I have done so far. in my telldus center software, everything works well. light goes on and off. I only set up one light with device name lounge.


I downloaded Garry's first xml file and the last xml file for Telldus, and i only change the location of the tdtool.exe bucause i use 64bit windows. I saved it in the command tree and closed it.  I executed the "List" command by saying "Refresh Tellus devices" VC understood me and seemed to execute the command but i get one orange error messages in the History window and error say unknown base action. when i look at the tellusdevices.xml in payload XML file. the is not empty. i have the device nam lounge in side. I have attached my log file to this post.

i really appreciate your help.
 

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #35 on: March 25, 2018, 10:53:07 AM »
Based on the log you posted, it looks like it correctly scanned your devices and found one named "lounge".

Did you try to switch the lights by saying "turn lounge on", or "turn lounge off" ?

maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #36 on: March 25, 2018, 11:18:39 AM »
Oh i just try the magic word and it is working! Thank you guys!

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #37 on: March 25, 2018, 11:44:31 AM »
That's great news.

Just remember that you should be able to use the voice command "Show Help" or "What can I say?" to display a page with all your voice commands. The page will open up in your web browser.

It can be helpful when you import new commands into your configuration.

http://voxcommando.com/mediawiki/index.php?title=FAQ#General

If you are not using a standard configuration that comes with this command, you can click "Help > Build Voice Menu" instead.

But it is usually recommended that people install a standard configuration and then add commands as needed, because otherwise it is difficult to learn how to use the program.
« Last Edit: March 25, 2018, 12:25:58 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)

maxwel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 1
    • View Profile
Re: Telldus Tellstick Light control from VoxCommando (no
« Reply #38 on: March 25, 2018, 01:16:37 PM »
Hi nimester,

I was completely forgot to check the Build Voice Menu.. it is very helpful.  thank you again.