Merge branch 'master' of github.com:node-red/node-red-nodes

This commit is contained in:
Ben Hardill 2022-04-18 13:25:47 +01:00
commit 2daf4f4360
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7

View File

@ -338,6 +338,17 @@ WeMoNG.prototype.get = function get(deviceID) {
}
WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
var body = [
postbodyheader,
'<u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">',
'<BinaryState>%s</BinaryState>',
'</u:SetBinaryState>',
postbodyfooter
].join('\n');
var data = util.format(body, on);
var postoptions = {
host: socket.ip,
port: socket.port,
@ -346,7 +357,8 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
headers: {
'SOAPACTION': '"urn:Belkin:service:basicevent:1#SetBinaryState"',
'Content-Type': 'text/xml; charset="utf-8"',
'Accept': ''
'Accept': '',
'Content-Length': data.length
}
};
@ -372,15 +384,7 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
post_request.abort();
});
var body = [
postbodyheader,
'<u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">',
'<BinaryState>%s</BinaryState>',
'</u:SetBinaryState>',
postbodyfooter
].join('\n');
post_request.write(util.format(body, on));
post_request.write(data);
post_request.end();
}
@ -394,6 +398,7 @@ WeMoNG.prototype.getSocketStatus = function getSocketStatus(socket) {
'SOAPACTION': getSocketState.action,
'Content-Type': 'text/xml; charset="utf-8"',
'Accept': ''
'Content-Length': getSocketState.body.length
}
}