Author Topic: Belkin Wemo and Phillips Hue Support  (Read 24797 times)

0 Members and 1 Guest are viewing this topic.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #45 on: December 23, 2014, 01:33:38 PM »
Nice! Thanks for the posts, PegLeg.
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #46 on: February 10, 2015, 11:54:59 AM »
I'm getting an error when trying to turn my WeMo on and off when its on the wrong port now



I've been using my Auto Port finder for awhile now, but I started to get an error that I've never seen before

It no longer triggers the event like it used to

I tried to change the "(A)==(B)" to "last action successes" but it only triggers the port to change once and then scrapes the post the second time even though it was not successful

I only changed the "lights on" command, the "lights off" and "Toggle lights" commands are still the same as the post I shared 
I also included a map builder command, IP will need to be changed
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="True" name="Lights 2.0" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1235" name="Map Table Creater for lights setup" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You can create the table by hand or using this command.  Be sure to set the IP address correctly. after executing this command then it can be deleted ">
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>Wemos</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>Wemos</param>
        <param>W01</param>
        <param>192.168.1.249:49153</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="774" name="Turn Lights on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>Lights On</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>Lights on</event>
    <phrase>lights on</phrase>
  </command>
  <command id="782" name="Turn Lights off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>Lights Off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>Lights off</event>
    <phrase>Lights off</phrase>
  </command>
  <command id="825" name="Toggle Lights" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>Lights</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>BinaryState&gt;([01])&lt;/BinaryState</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Match.1}&amp;&amp;1</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Lights please</phrase>
    <event>Lights</event>
  </command>
  <command id="792" name="rotate port" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Testing Next Port</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>Wemos</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49155</param>
        <param>:looparound</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49154</param>
        <param>:49155</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49153</param>
        <param>:49154</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:looparound</param>
        <param>:49153</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>Wemos</param>
        <param>{1}</param>
        <param>{LastResult}</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VcAdvanced.Log</cmdType>
      <params>
        <param>Setting Wemo {1} addr. to {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>{2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Wemo.RotatePort</event>
  </command>
</commandGroup>


I really hope Belkin just decided to drop the other two ports ( wishful thinking on my end)

any help would be great

Thanks

EDIT: using VC 2.138

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #47 on: February 10, 2015, 01:08:14 PM »
Testing out your problem, I ran into the same issue but only with 2.1.3.8.

James suggested I try to run VC as administrator (because he's been attempting to resolve UAC-related user problems in his code recently).

Running as administrator fixed the problem for me. In fact, I only had to run as admin once. Afterward, when I relaunched VC no longer as admin, it continued to work for me.

I'm on a W7 machine though. It would be great if you could test this out on your W8 machine and report back.
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #48 on: February 10, 2015, 02:39:19 PM »
thanks for the reply

tried to run as admin and received a new error this time



I then launched it normal (non admin) and had the new error show again

so I'm not seeing the original error

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #49 on: February 10, 2015, 03:02:01 PM »
Hmm. Now that you mention it, I never had the connection refusal error. The timed out error is actually the only error I was receiving, and that disappeared when I switched to admin.

The "heightened security" of W8, perhaps.  ::)

Anyhoo, for now you may want to revert to 2.1.3.6 for your main config.  (Maybe keep using the xJson.dll from 2.1.3.8, though, since you're a hardcore XBMC user.)

http://voxcommando.com/mediawiki/index.php?title=ChangeLog#Version_2.1.3.8

I'll log the problem so that James can try to investigate using one of the W8 testing machines when he has time. If you make any other discoveries on this, let us know.

Thanks for the report, and sorry for the headache!
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #50 on: February 10, 2015, 04:33:20 PM »
okay now I'm really lost I switched back to my copy of 2.136 to see if that helped, but no luck

I'll keep doing some digging to see if I can find anything else

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #51 on: February 10, 2015, 04:38:47 PM »
Nuts.

Any chance you could have added typos/errors to your command xml in the meantime, while attempting to fix the problem?

Might be worth grabbing the xml you posted to the forum and using that as your test group, just in case.
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #52 on: February 10, 2015, 04:45:59 PM »

It works when I manually change the port number in the map, but it no longer rotates through the ports when my WeMo switches ports, so for now I'll keep digging and just manually switch the ports when needed




PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #53 on: February 10, 2015, 10:47:42 PM »
did some more testing and was able to get it working using "LastActionSuccess"  instead, this is the only group that I use {Empty} so I'm not sure if there could be something wrong with that (not suggesting there is, just curious)

this command is if the first post of Wemo auto port set is no longer working for you

Wemo auto port set 2.0:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="False" name="Wemo auto port set 2.0" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1219" name="!!! Run once to set Map Table  with W01 to 192.168.0.106:49153" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You can create the table by hand or using this command.  Be sure to set the IP address correctly. after executing this command then it can be deleted ">
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>Wemos</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>Wemos</param>
        <param>W01</param>
        <param>192.168.0.106:49153</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="758" name="Turn wemo on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>WeMo On</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Turn wemo on</phrase>
    <event>WeMo On</event>
  </command>
  <command id="766" name="Turn wemo off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{LastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>WeMo Off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Turn wemo off</phrase>
    <event>WeMo Off</event>
  </command>
  <command id="800" name="Toggle wemo" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>BinaryState&gt;([01])&lt;/BinaryState</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>W01</param>
            <param>Toggle WeMo</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Match.1}&amp;&amp;1</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:Wemos.W01}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>toggle wemo</phrase>
    <event>Toggle WeMo</event>
  </command>
  <command id="776" name="rotate port" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Testing Next Port</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>Wemos</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49155</param>
        <param>:looparound</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49154</param>
        <param>:49155</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49153</param>
        <param>:49154</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:looparound</param>
        <param>:49153</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>Wemos</param>
        <param>{1}</param>
        <param>{LastResult}</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VcAdvanced.Log</cmdType>
      <params>
        <param>Setting Wemo {1} addr. to {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>{2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Wemo.RotatePort</event>
  </command>
</commandGroup>


will post the MultiWeMo auto port set in the next post


« Last Edit: February 10, 2015, 10:53:51 PM by PegLegTV »

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #54 on: February 10, 2015, 10:49:09 PM »
use this group if multiWeMo Auto Port set is no longer working for you

MultiWeMo Auto Port set 2.0:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="False" name="MultiWemo auto port set 2.0" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1230" name="!!! Run once to set up MultiWeMo map table !!!!change ip addresses!!!!" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You can create the table by hand or using this command.  Be sure to set the IP addresses names correctly. after executing this command then it can be deleted ">
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>MultiWeMos</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>MultiWeMos</param>
        <param>Living Room</param>
        <param>192.168.1.249:49153</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>MultiWeMos</param>
        <param>Bedroom</param>
        <param>192.168.1.249:49154</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>MultiWeMos</param>
        <param>Kitchen</param>
        <param>192.168.1.249:49155</param>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="769" name="Turn wemo on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>{1}</param>
            <param>WeMo On</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Turn</phrase>
    <payloadList>Living Room, Bedroom, Kitchen</payloadList>
    <phrase>wemo on</phrase>
    <event>WeMo On</event>
  </command>
  <command id="777" name="Turn wemo off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{LastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>{1}</param>
            <param>WeMo Off</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Turn</phrase>
    <payloadList>Living Room, Bedroom, Kitchen</payloadList>
    <phrase>wemo off</phrase>
    <event>WeMo Off</event>
  </command>
  <command id="807" name="Toggle wemo" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape.Post</cmdType>
      <params>
        <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
        <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:GetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
        <param />
        <param />
        <param>text/xml; charset="utf-8"</param>
        <param>SOAPAction: "urn:Belkin:service:basicevent:1#GetBinaryState"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>{lastResult}&amp;&amp;{Empty}</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>BinaryState&gt;([01])&lt;/BinaryState</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>Wemo.RotatePort</param>
            <param>{1}</param>
            <param>Toggle WeMo</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Match.1}&amp;&amp;1</ifParams>
      <then>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;0&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape.Post</cmdType>
          <params>
            <param>http://{M:MultiWeMos.{1}}/upnp/control/basicevent1</param>
            <param>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"&gt;&lt;BinaryState&gt;1&lt;/BinaryState&gt;&lt;/u:SetBinaryState&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;</param>
            <param />
            <param />
            <param>text/xml; charset="utf-8"</param>
            <param>SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>toggle</phrase>
    <payloadList>Living Room, Bedroom, Kitchen</payloadList>
    <phrase>wemo</phrase>
    <event>Toggle WeMo</event>
  </command>
  <command id="787" name="rotate port" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Testing Next Port</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>MultiWeMos</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49155</param>
        <param>:looparound</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49154</param>
        <param>:49155</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:49153</param>
        <param>:49154</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>:looparound</param>
        <param>:49153</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>MultiWeMos</param>
        <param>{1}</param>
        <param>{LastResult}</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VcAdvanced.Log</cmdType>
      <params>
        <param>Setting Wemo {1} addr. to {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>{2}</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Wemo.RotatePort</event>
  </command>
</commandGroup>

Thanks for the help nime5ter
« Last Edit: February 10, 2015, 10:55:40 PM by PegLegTV »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #55 on: February 11, 2015, 11:21:37 AM »
did some more testing and was able to get it working using "LastActionSuccess"  instead, this is the only group that I use {Empty} so I'm not sure if there could be something wrong with that (not suggesting there is, just curious)

For what you're trying to evaluate, "LastActionSuccess" seems like the right choice.

I'm actually not sure how/why evaluating {LastResult} = {Empty} was ever working for you for this command. As I understand it, you were attempting to get a status from your Wemo, and if you could not get a status, then you were triggering the command to try a different port. Is that right?

The problem is that {LastResult} is almost never empty, except maybe when VC launches (and even then, many times we have commands running on VC.Loaded that will return some kind of result).

In this case, your Scrape action isn't returning an "empty" result -- it's not able to execute the scrape at all because it can't connect to the wrong port.

Because {LastResult} is essentially a global variable, if your Scrape action is unsuccessful, the value of {LastResult} will remain as the value that it had previously been set to by some other, successful action that returns a result.

« Last Edit: February 11, 2015, 11:23:52 AM 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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: Belkin Wemo and Phillips Hue Support
« Reply #56 on: February 11, 2015, 01:53:37 PM »
I'm actually not sure how/why evaluating {LastResult} = {Empty} was ever working for you for this command. As I understand it, you were attempting to get a status from your Wemo, and if you could not get a status, then you were triggering the command to try a different port. Is that right?

yep, that is exactly it, I honestly don't remember why I used "(A)==(B)---{LastResult}=={Empty}" but it worked for a while, I was wondering the same thing when I started to have problems with it, so I tried "LastActionSuccses" and that seemed to take care of it.

why they felt the need to rotate ports, is beyond me when each device has it's own IP,

once I get some more Milights I'll only use the WeMo outlet switch for my Christmas Tree so that way hopefully it wont be as big of a headache but still get some good use out of it

Thanks again for the help


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Belkin Wemo and Phillips Hue Support
« Reply #57 on: February 11, 2015, 03:26:31 PM »
Yeah, I find the Wemos to be perplexing products in general. :)

Here's hoping the Milights are somewhat durable!

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)