iancmcc/ouimeaux

Mini smartplug help

strunker opened this issue · 6 comments

Hello all,

I am a bit confused with ouimeaux.

Following the documentation I copied the below snippet. I am trying to talk to my new mini smart plug, doesnt seem like the plugs are specifically supported by ouimeaux.

When I call the discovery method below nothing is ever returned. I have the smart plug turned on with an ip address, etc, it works through the mobile app but doesnt ever get discovered by ouimeaux.

any recommendation? I set the IP static on my router, is it possible to specify the ip and instantiate a switch object by ip?

thanks.

from ouimeaux.environment import Environment
def on_switch(switch):
print "Switch found!", switch.name
env = Environment(on_switch)
env.start()
env.discover(seconds=30)

has anyone ever tried formulating their own soap requests. I attempted to do the below after reviewing the source code for oumieaux, but still doesnt seem to work properly

I get an error back "

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
s:Client
UPnPError


-111
Invalid Action


</s:Fault>
</s:Body>
</s:Envelope>"


REQUEST_TEMPLATE = """
<?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:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">
  	<BinaryState>0</BinaryState>
  </u:SetBinaryState>
 </s:Body>
</s:Envelope>
"""

uri = "http://10.1.1.16:49153/upnp/control/basicevent1"

headers = {"content-type": "text/xml","SOAPACTION":"urn:Belkin:service:basicevent:1#SetBinaryState"}


request = api.post(uri,data=REQUEST_TEMPLATE,headers=headers,verify=False)
print dir(request)
print request.text

The wemo mini plug isn't showing up for me either after a wemo list call

Actually! It was because I had my VPN enabled, @iancmcc I can add a note to the readme if you'd like. It's probably obvious for most people but there are probably some people who might not realize this.

so... does mini smart plug works?..

it worked for me after I disabled my vpn

lecw commented

And it works for me too.

@strunker I also tried making my own SOAP requests and reached the same -111 Invalid Action point as you. Changing #SetBinaryState to :SetBinaryState would give me a 401 Invalid Action instead, but that's the furthest I could get before ouimeaux. With ouimeaux it just works.