[Legacy] How to add WeMo control

Topics related to the TouchControl Server software.
Post Reply
User avatar
Dave
Site Admin
Posts: 70
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

[Legacy] How to add WeMo control

Post by Dave » Sun Dec 20, 2015 10:27 pm

Original post by: Abelc

Hello, and thanks in advance for your help. I have a belkin WeMo switch that as far i know works with ssdp i found this code online and was thinking how to add it to touchcontrol, any help or ideas would be great!!! Thanksss!! . HTTPBuilder http = new HTTPBuilder("http://192.168.1.120:49153/upnp/control/basicevent1") http.request(Method.POST, ContentType.XML) { body = '' + '' + '' + '' + '1' + '' + '' + '' headers.'SOAPACTION' = "\"urn:Belkin:service:basicevent:1#SetBinaryState\"" headers.'Content-Type' = "text/xml; charset=\"utf-8\"" headers.'Accept' = "" }
November 6, 2015 at 1:11 PM Edit Delete Flag Quote & Reply

Dave Arnold
Site Owner
Posts: 681
I'm guessing there were some xml tags that you tried to include in the above post where the empty quotes are? Unfortunately this forum will eat those. Try adding them back with alternate characters for the < and > just so we can see what it's supposed to look like.
November 6, 2015 at 3:52 PM Edit Delete Flag Quote & Reply

Abelc
Limited Member
Posts: 19 Im trying to change and it only let me post a number 1 haha i dont know whats going on
November 6, 2015 at 6:28 PM Edit Delete Flag Quote & Reply

Abelc
Limited Member
Posts: 19
i think i got it lol hope now you can see it!° thanks!

HTTPBuilder http = new HTTPBuilder("http://192.168.1.120:49153/upnp/control/basicevent1")
http.request(Method.POST, ContentType.XML) {
body = '=?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>1
'=/u:SetBinaryState=' +
'=/s:Body=' +
'=/s:Envelope='
headers.'SOAPACTION' = "\"urn:Belkin:service:basicevent:1#SetBinaryState\""
headers.'Content-Type' = "text/xml; charset=\"utf-8\""
headers.'Accept' = ""
November 6, 2015 at 7:38 PM Edit Delete Flag Quote & Reply

Dave Arnold
Site Owner
Posts: 681
To execute the above command using TouchControl, first create an Interface Manager entry in TC Server (if you haven't already) using the IP address and port shown (IP 192.168.1.120 and port 49153). Then create an HTTP Request button, and point its host to this new interface. Set the button's method to POST, and enter the entire xml payload in the body field:

<?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>1</u:SetBinaryState>
</s:Body>
</s:Envelope>


Then right-click on the button and select "Properties...". All HTTP buttons have an available "HTTPHeaders" property in the "Name" dropdown list. Select this property, and enter all of the headers shown above like this:
SOAPACTION="urn:Belkin:service:basicevent:1#SetBinaryState"^Content-Type=text/xml;charset="utf-8"

Then place the button on your layout. Hope this helps.
November 9, 2015 at 11:40 PM Edit Delete Flag Quote & Reply

Abelc
Limited Member
Posts: 19
Thanks for the response Dave,
Ok, so i copy and paste and when i test the button is giving me: remote server error 500 internal error server,
i double check the host , port, ip, the button is POST, i dont know whats wrong.. :(

thanks again for your time
November 10, 2015 at 11:25 AM Edit Delete Flag Quote & Reply

Abelc
Limited Member
Posts: 19
Dave, here is more explained https://objectpartners.com/2014/03/25/a ... -and-wemo/
November 10, 2015 at 12:26 PM Edit Delete Flag Quote & Reply

Dave Arnold
Site Owner
Posts: 681
Hi Abelc. I think I would start with the SSDP sample activity on the download page, and see if your WeMo shows up as a controllable device. If it does, then we can start from there and add functionality.

Post Reply