Control Belkin wemo by lua http post

[quote=“xgutterratx, post:5, topic:190477”]this is the curl i have been trying and code is sent successfully but does not turn off the device.

local CMD = 'curl "http://192.168.1.6:49154/upnp/control/basicevent1" -d "<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>"' os.execute(CMD)[/quote]

The request is a SOAP request… and would require the SOAP request headers…

local CMD = 'curl "http://192.168.1.6:49154/upnp/control/basicevent1" -d "<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>" -H "SOAPAction:urn:Belkin:service:basicevent:1#SetBinaryState" -H "Content-Type: text/xml; charset=\"utf-8\""' os.execute(CMD)