Author Topic: Commands for multiple Belkin Wemos  (Read 2587 times)

0 Members and 1 Guest are viewing this topic.

Dominique

  • Jr. Member
  • **
  • Posts: 41
  • Karma: -1
    • View Profile
Commands for multiple Belkin Wemos
« on: July 08, 2014, 11:39:49 AM »
Kalle,

   Here is what I want to do, I want to use Denise as a talking head like you did.  However I also want to control my home automation setup without using eventghost if possible.  One way I can control my devices is with IFTTT by sending email triggers.

http://youtu.be/HJuZXMzqiWQ

The problem I have faced with V.C. is that I do not know if it is possible to compose or even send email.  I see that you can call or get email but did not see anything about sending one.  In the video above, I show Denise toggling my devices by sending email triggers.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Commands for multiple Belkin Wemos
« Reply #1 on: July 08, 2014, 12:05:14 PM »
You can control your Belkin Wemo directly from VC. http://voxcommando.com/forum/index.php?topic=1261.msg12793#msg12793

Yes, you can send emails. You need to set up your SMTP server in VC options. http://voxcommando.com/mediawiki/index.php?title=Options

There are then SMTP actions within your commands.

There is a ton of documentation on the wiki etc. It does take time to digest. VC is a very versatile program; there's a learning curve and a lot of details that take some time to explore.
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)

Dominique

  • Jr. Member
  • **
  • Posts: 41
  • Karma: -1
    • View Profile
Commands for multiple Belkin Wemos
« Reply #2 on: July 08, 2014, 03:39:28 PM »
You can control your Belkin Wemo directly from VC. http://voxcommando.com/forum/index.php?topic=1261.msg12793#msg12793

Yes, you can send emails. You need to set up your SMTP server in VC options. http://voxcommando.com/mediawiki/index.php?title=Options

There are then SMTP actions within your commands.

There is a ton of documentation on the wiki etc. It does take time to digest. VC is a very versatile program; there's a learning curve and a lot of details that take some time to explore.

Yes I saw that @Nime5ter however I have 4 different Wemo devices, how do I decipher which is turned on/off?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Commands for multiple Belkin Wemos
« Reply #3 on: July 08, 2014, 04:06:51 PM »
I don't have a Wemo and don't know much about it, but I assume each one has its own IP address? You will need to know which device has which IP address.

You could then create a payload xml file in which each Wemo's IP address is associated with a friendly name, like "corner light", "kitchen light" etc. (example file is attached)

Rather than just saying "Turn wemo on" or "off". You then specify which one when issuing your command. Within the command, VC will refer to your payload XML file to find the correct IP address for that friendly name.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<commandGroup open="True" name="wemo" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <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://{1}:49153/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>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>Turn</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">wemoDevices.xml</payloadFromXML>
    <phrase>on</phrase>
  </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://{1}:49153/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>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>Turn</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">wemoDevices.xml</payloadFromXML>
    <phrase>off</phrase>
  </command>
</commandGroup>

If you're not yet familiar with payload xml and how that works, you might want to watch the Vera \Home Automation tutorial video. A lot of the explanations apply generally in VC, whether or not you're using the Vera plugin.

Here is a master list of available video tutorials: http://voxcommando.com/mediawiki/index.php?title=Video_Tutorials. You should also watch the Fundamentals videos on editing commands.
« Last Edit: July 08, 2014, 04:10:42 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: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Commands for multiple Belkin Wemos
« Reply #4 on: July 08, 2014, 04:11:35 PM »
note: I just edited my post above to correct a mistake in my initial command xml, so make sure to grab the corrected version.
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: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Commands for multiple Belkin Wemos
« Reply #5 on: July 08, 2014, 04:56:45 PM »
Yes I saw that @Nime5ter however I have 4 different Wemo devices, how do I decipher which is turned on/off?

Originally you said that you could control your Wemo lights by sending an email to IFTTT.

So now you know how to send an email from VC.  But you can also control the lights directly (much faster) if you know the IP address of each light which should be pretty easy to figure out, assuming they are not changing all the time.

Now it sounds like you want to monitor the status of your lights, to know whether they are off, which is something else completely.  Which is it?  What are you trying to accomplish?  How were you doing this before?

Dominique

  • Jr. Member
  • **
  • Posts: 41
  • Karma: -1
    • View Profile
Commands for multiple Belkin Wemos
« Reply #6 on: July 08, 2014, 05:02:50 PM »
Originally you said that you could control your Wemo lights by sending an email to IFTTT.

So now you know how to send an email from VC.  But you can also control the lights directly (much faster) if you know the IP address of each light which should be pretty easy to figure out, assuming they are not changing all the time.

Now it sounds like you want to monitor the status of your lights, to know whether they are off, which is something else completely.  Which is it?  What are you trying to accomplish?  How were you doing this before?

No, I do not care to know the status.  I had read that the ip address changes so that was why I used the IfTTT method.  On my phone it is easy, I use Tasker.  However toggling devices by voice from computer is also desired.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Commands for multiple Belkin Wemos
« Reply #7 on: July 08, 2014, 05:43:25 PM »
You should be able to set the IPs to remain constant in your router settings.

In case anyone wants to check the current status of a light here is a sample command.  You should only need to adjust the IP address to make it work.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<command id="889" name="Check Wemo status" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape.Post</cmdType>
    <params>
      <param>http://192.168.0.111:49153/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>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>BinaryState&gt;(.)&lt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>"{Match.1}"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Match.1}&amp;&amp;1</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>The wemo switch is ON</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>The Wemo switch is OFF</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Check Wemo status</phrase>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Commands for multiple Belkin Wemos
« Reply #8 on: July 08, 2014, 07:07:09 PM »
For those who have multiple units, it may be worthwhile to create a map table as well as the payload xml file mentioned above, to make it easier to create commands that target specific Wemo devices.

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

For example, you might have a "good morning" scene that is triggered at the same time each morning. It wishes you good morning, switches on the Wemo light in the bedroom, and tunes in to your morning radio station.

In this case, you want to target one particular Wemo. Sure, you could enter the IP address manually, but it's probably easier if you're going to start creating different commands targeting different devices to be able to drag and drop the correct IP address from you Wemo map table.
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)

Dominique

  • Jr. Member
  • **
  • Posts: 41
  • Karma: -1
    • View Profile
Re: Commands for multiple Belkin Wemos
« Reply #9 on: August 02, 2014, 10:44:07 PM »
@jitterjames

I have a question.  How did you find the IP Address of your Wemo Device?  I have several and I cannot seem to figure out how you did it.  Once I have that, I would like to try out that code.

EDIT:  I just saw the other thread that you made a plugin for it.  Excited about that.  However I am still curious on how you located the IP Addresses of the devices.  Cant seem to find anything on it anywhere online.
« Last Edit: August 02, 2014, 11:05:30 PM by Dominique »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Commands for multiple Belkin Wemos
« Reply #10 on: August 02, 2014, 11:13:40 PM »
My Wemo appears in "my network places" in Windows 7.  There are also many others ways to find the IP addresses of devices on your network.
« Last Edit: August 03, 2014, 10:54:03 AM by jitterjames »