more G-Labs products

Author Topic: Wemo and command  (Read 3682 times)

September 16, 2014, 02:36:56 PM
Read 3682 times

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi,

I buy a WeMo Switch (http://www.belkin.com/us/p/P-F7C027/) and after the configuration i can control in command line with the following script :
http://moderntoil.com/?p=839

So i think to add the control in homegenie by using the command line describe here :
http://www.homegenie.it/forum/index.php?PHPSESSID=ggcdvb4i6ddoa72uush64hssq0&topic=352.msg2000#new

But if i want to add a real equipment in HG, i have some questions :
1/ HG uPNP doesn't detect The Wemo
1.1/ Limitation on range ports ? (WeMo listen on port 49153 and 49152)
1.2/ WeMo is not recognize because it can be control ? (not a multimedia device)

2/ Is it possible to add the good xml request to command this device ?

3/ Is it possible to transpose the following request in the NetHelper and call url ?
Code: [Select]
curl -0 -A ? -X POST -H ?Accept: ? -H ?Content-type: text/xml; charset=?utf-8″? -H ?SOAPACTION: ?urn:Belkin:service:basicevent:1#GetBinaryState?" ?data ?<?xml version=?1.0″ encoding=?utf-8″?><s:Envelope xmlns:s=?http://schemas.xmlsoap.org/soap/envelope/? s:encodingStyle=?http://schemas.xmlsoap.org/soap/encoding/?><s:Body><u:GetBinaryState xmlns:u=?urn:Belkin:service:basicevent:1″><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>? -s http://$IP:$PORT/upnp/control/basicevent1 |
grep ?<BinaryState?  | cut -d?>? -f2 | cut -d ?<? -f1 | sed ?s/0/OFF/g? | sed ?s/1/ON/g?
I try with the following one :
Code: [Select]
var result = Net.WebService("http://10.0.0.102:49153/upnp/control/basicevent1").AddHeader("Accept", "").AddHeader("Content-type", "text/xml; charset="utf-8"").AddHeader("SOAPACTION", ""urn:Belkin:service:basicevent:1#GetBinaryState"").GetData("<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>");
Program.Notify("result = ", result);
But it doesn't work.

Someone can help about this ?

Bye

September 16, 2014, 02:58:47 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
try this way:

Code: [Select]

var request = Net.WebService("http://10.0.0.102:49153/upnp/control/basicevent1")
    .AddHeader("Accept", "")
    .AddHeader("Content-type", "text/xml; charset="utf-8"")
    .AddHeader("SOAPACTION", ""urn:Belkin:service:basicevent:1#GetBinaryState"")
    .Post("<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>");

var result = request.GetData();
Program.Notify("result = ", result);


g.

December 31, 2014, 03:37:23 PM
Reply #2

boblablah

  • *
  • Information
  • Newbie
  • Posts: 6
Is WeMo control something that is being considered for bundling into the existing HG builds? I see WeMo has switches, lights and is now being partnered with Connected by TCP (TCPi) lighting...   

December 31, 2014, 04:49:04 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
WeMo could be added.  The odds would be better if someone who had a WeMo hub of some kind were to build the code necessary for HG and submit it.  If you don't have the capability to do that yourself, the other options are to send a donation of hardware or money to Gene so that he could buy the hardware and get something working.  I don't know what his schedule is, so it might take some time after he got the hardware (assuming it was high on the priority list).

http://www.homegenie.it/forum/index.php?topic=217.0


The other option is to do as much research as you can on WeMo and provide the details in a thread here.  If you can find C# code that instantiates a WeMo control API for example, that would probably make inclusion really easy and straight forward.  In that case, since Gene or whoever incorporates the code doesn't necessarily have the hardware, you would need to provide debugging support to get the code working 100%.

January 01, 2015, 06:42:21 AM
Reply #4

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi,

I didn't find the right URL to call, because the URL is so so long.
So i find another way in installing this :
http://ouimeaux.readthedocs.org/
Which permit to switch on, off, and have the status in command line.
But this solution is too slow on raspberry, but i try on other computer and the time to execute and have the result is so best.
But my aim is to run on raspberry, so i stop here.
So if you can do by URL call, i think it's a better way ...

My HG script just call the command line of "ouimeaux".

HappY NeW YeaR