Author Topic: Using VC with Insteon  (Read 10819 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Using VC with Insteon
« Reply #15 on: January 09, 2015, 11:13:50 AM »
any action that modifies {LastResult} will do so automatically, but if an action fails then it will not update the {LastResult}.  Some actions do not modify {LastResult}, in this case they may still show some kind of info in the history window.

{LastResult} will remain between actions and commands until it is changed.

What kind of Insteon controller do you have, and what is the command xml that you are using?

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Using VC with Insteon
« Reply #16 on: January 09, 2015, 11:46:36 AM »
I have the insteon hub.

I have 1 command to turn the light on then immediately I use the test get status command and thats the result.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.7-->
<command id="399" name="Game On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="92" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.OpenBat</cmdType>
    <params>
      <param>c:\users\soda\documents\gameon.bat</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://xxx.xxx.xxx.xxx:25105/3?026228F0CC0F117F=I=3</param>
      <param>id</param>
      <param>password</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>bon all hoi game fon dun, tung all hoi game fon dun</phrase>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.7-->
<command id="729" name="lamplinc test get status" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You must adjust the URL and the device ID to match your hardware.&#xD;&#xA;I am using the action Results.SetLastResult because I don't have an insteon to test with.  You can leave it so this action is skipped.">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://xxx.xxx.xxx.xxx:25105/3?026228F0CC0F19FF=I=3</param>
      <param>id</param>
      <param>password</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>500</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://xxx.xxx.xxx.xxx:25105/buffstatus.xml</param>
      <param>id</param>
      <param>password</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>&lt;response&gt;&lt;BS&gt;026228F0CC0F117F06025028F0CC16A9442B117F&lt;/BS&gt;&lt;/response&gt;</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>060250(......).*?(..)&lt;/BS&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>DeviceID: {Match.1.1} Level: {Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Match.1.2}&amp;&amp;00</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>The device is off</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>The device is on</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>lamplinc test get status</phrase>
</command>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Using VC with Insteon
« Reply #17 on: January 09, 2015, 02:19:30 PM »
It might not work with the hub.

You can try a few things.

1 - Don't switch the light and then test it immediately.  Give it a couple minutes.

2 - in the VC.Pause action change the delay parameter from 500 to 1000.

Other than that I have no idea and we have no way of testing it to try to figure it out.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Using VC with Insteon
« Reply #18 on: January 09, 2015, 02:51:04 PM »
We just follow documentation posted online to guess these things. Without having the devices, there is no way for us to know.

If you have the devices, I recommend researching for Insteon Hub documentation online (official and unofficial) and trying out the various suggestions. The issue is not VC.

For example, in this forum thread, they are suggesting there may be an alternative URL for getting device status information:

Quote
4. There is a new URL where it's easier to get device status, instead of the buffstatus.xml
http://X.X.X.X:25105/sx.xml?ABABAB=1900
(Get status for device ABABAB)

http://forum.smarthome.com/topic.asp?TOPIC_ID=13762

Maybe that will work for you. Or you could post your issue to that forum to see if your fellow Insteon Hub users can give you the proper URL.
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)

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Using VC with Insteon
« Reply #19 on: January 09, 2015, 02:57:57 PM »
ha yea i just saw that online too.

the xml is a lil different.

action result: <?xml version="1.0" encoding="ISO-8859-1" ?>
<Xs>
<X D="28F0CC25007F"/>
</Xs>

the last 2 after 2500 is the level.

I changed the Results.RegEx to this

D="(......).*?(..)"/>

and seems like it works now.


Thank you very much guys

« Last Edit: January 09, 2015, 03:24:00 PM by Soda97 »

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Using VC with Insteon
« Reply #20 on: January 09, 2015, 03:33:25 PM »
<X\sD=".*?(\w\w)"/>

o that works too.

again thank you very much guys!

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Using VC with Insteon
« Reply #21 on: January 09, 2015, 03:33:46 PM »
Great. Maybe you can post the xml for your working command. That will be useful for others who have an Insteon Hub. Thanks.
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)

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Using VC with Insteon
« Reply #22 on: January 09, 2015, 03:50:52 PM »
For Insteon Hub to get device status, input your IP address (XXX.XXX.XXX.XXX), device ID (ABABAB), your hub ID and password.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.7-->
<command id="729" name="Get Device status" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You must adjust the URL and the device ID to match your hardware.">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://XXX.XXX.XXX.XXX:25105/sx.xml?ABABAB=1900</param>
      <param>ID</param>
      <param>PASSWORD</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;X\sD="(......).*?(\w\w)"/&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>DeviceID: {Match.1.1} Level: {Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Match.1.2}&amp;&amp;00</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>The device is off</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>The device is on</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Get device status</phrase>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Using VC with Insteon
« Reply #23 on: January 09, 2015, 04:34:34 PM »
Awesome, thanks again.

If you have multiple devices and know their device IDs, you can create a payload XML table (example attached) and then use the following command to check the status of any of the devices.

http://voxcommando.com/mediawiki/index.php?title=Payloads#More_on_Payload_XML

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<command id="729" name="Get status of {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You must adjust the URL and the device ID to match your hardware.">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://XXX.XXX.XXX.XXX:25105/sx.xml?{1}=1900</param>
      <param>HUB ID</param>
      <param>PASSWORD</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;X\sD=".*?(\w\w)"/&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Device: {PF.1} Level: {Match.1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Match.1}&amp;&amp;00</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>{PF.1} is off</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>{PF.1} is on</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Get status of</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\insteon_devices.xml</payloadFromXML>
</command>
« Last Edit: January 09, 2015, 09:26:57 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)

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Using VC with Insteon
« Reply #24 on: January 09, 2015, 05:45:44 PM »
wow sweet! I was going to ask you how to do that but didnt want to confuse myself.  you made it a lot easier to follow.

much appreciated.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Using VC with Insteon
« Reply #25 on: January 10, 2015, 02:57:30 AM »
For example, in this forum thread, they are suggesting there may be an alternative URL for getting device status information:
http://forum.smarthome.com/topic.asp?TOPIC_ID=13762

sweet ... it makes life easier ... 

if needed to convert dim level to percentage one can use this (passing the dim level in hex as {Match.1.2}, and get the result in {LastResult})

PY.ExecString result = round(0x{Match.1.2}/2.55,0)

here is the old way of getting status, just for reference....

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<command id="308" name="Get Status" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Send get status 19 is the command&#xD;&#xA;02620EA7220F117F   06                       0250                0EA722          16A944         2        B                    11             7F&#xD;&#xA;Last Command     + Response Flag + Return Flag + Target Device + SmartLinc + Ack + Hop Count + DB Delta + Level&#xD;&#xA;06 success &#xD;&#xA;15 failure&#xD;&#xA;">
  <action>
    <cmdType>VC.TriggerEvent</cmdType>
    <params>
      <param>InsteOn.Do</param>
      <param>3?0262{1}0F19FF=I=3</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>1000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.TriggerEvent</cmdType>
    <params>
      <param>InsteOn.Do</param>
      <param>buffstatus.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>&lt;/BS&gt;&lt;/response&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <params>
      <param>(......................................................).*$</param>
      <param>$1</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;0262{1}0F19FF</ifParams>
    <then>
      <action>
        <cmdType>Results.Replace</cmdType>
        <params>
          <param>&lt;response&gt;&lt;BS&gt;0262{1}0F19FF</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.Replace</cmdType>
        <params>
          <param>0250</param>
          <param>,</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>Error</param>
          <param>Status Buffer include info by a different command</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;06,</ifParams>
    <then>
      <action>
        <cmdType>Results.Replace</cmdType>
        <params>
          <param>06,</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>Error</param>
          <param>Status request failed</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;{1}</ifParams>
    <then>
      <action>
        <cmdType>Results.Replace</cmdType>
        <params>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>Status</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>Error</param>
          <param>Status Buffer include info for another device</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>PayloadXML.GetValue</cmdType>
    <params>
      <param>{Path.VC}\payloads\InsteOnDevices.xml</param>
      <param>Hub</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>Hub</param>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{Var.Status}&amp;&amp;{Var.Hub}</ifParams>
    <then>
      <action>
        <cmdType>Results.SetLastResult</cmdType>
        <params>
          <param>{Var.Status}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.Replace</cmdType>
        <params>
          <param>{Var.Hub}2</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegExReplace</cmdType>
        <params>
          <param>.*(..)$</param>
          <param>$1</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PY.ExecString</cmdType>
        <params>
          <param>result = round(0x{LastResult}/2.55,0)</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>Error</param>
          <param>Status Request by another machine</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{Var.Error}&amp;&amp;Status</ifParams>
    <then>
      <action>
        <cmdType>Results.SetLastResult</cmdType>
        <params>
          <param>{Var.Error}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>Status</param>
      <param>0</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>Hub</param>
      <param>0</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>Error</param>
      <param>0</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;0</ifParams>
    <then>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>feedback</param>
          <param>it is off</param>
          <param>2</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>feedback</param>
          <param>it is on at {LastResult}</param>
          <param>2</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <event>InsteOn.Get Status</event>
  <phrase>Tell me, What is</phrase>
  <phrase optional="true">the</phrase>
  <phrase>Status</phrase>
  <phrase optional="true">of</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\InsteOnDevices.xml</payloadFromXML>
  <phrase optional="true">?</phrase>
</command>

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<command id="335" name="Insteon Do " enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://{M:Credentials.InsteOnHubIP}/{1}</param>
      <param>{M:Credentials.InsteOnHubID}</param>
      <param>{M:Credentials.InsteOnHubPassword}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>InsteOn.Do</event>
</command>
« Last Edit: January 10, 2015, 03:19:28 AM by Haddood »
When Voice command gets tough, use hand gestures