You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the myStrom switch node(s) already contain the IP address it would be nice to just only send a request in taskJSON by inserting the following in function myStromSwitch.js:
this.on("input", function(msg) { <= existing line
var taskJSON = msg["payload"] <= existing line
// allow for only receiving a reqest in taskJSON
if (!taskJSON.hasOwnProperty("ip")) {taskJSON.ip = this.device.host};
if (!taskJSON.hasOwnProperty("mac")) {taskJSON.mac = this.device.mac};
By this the same command can be sent to several switch nodes
As the requests 'on' and 'off' do not return an answer from the switch, there always results an error message, but the switch is correctly switching. The error message may be inhibited by faking a return message in function requests.js:
var http = require("http"); <= existing line
var body = ""; <= existing line
// 'on' and 'off' requests for a switch do not send a response
if (type === "switch") {
if (taskJSON.request === "on") {body = "ON sent"};
if (taskJSON.request === "off") {body = "OFF sent"};
};
Please see these as friendly suggestions, I know that there may be better solutions.
The text was updated successfully, but these errors were encountered:
As the myStrom switch node(s) already contain the IP address it would be nice to just only send a request in taskJSON by inserting the following in function myStromSwitch.js:
this.on("input", function(msg) { <= existing line
var taskJSON = msg["payload"] <= existing line
// allow for only receiving a reqest in taskJSON
if (!taskJSON.hasOwnProperty("ip")) {taskJSON.ip = this.device.host};
if (!taskJSON.hasOwnProperty("mac")) {taskJSON.mac = this.device.mac};
By this the same command can be sent to several switch nodes
As the requests 'on' and 'off' do not return an answer from the switch, there always results an error message, but the switch is correctly switching. The error message may be inhibited by faking a return message in function requests.js:
var http = require("http"); <= existing line
var body = ""; <= existing line
// 'on' and 'off' requests for a switch do not send a response
if (type === "switch") {
if (taskJSON.request === "on") {body = "ON sent"};
if (taskJSON.request === "off") {body = "OFF sent"};
};
Please see these as friendly suggestions, I know that there may be better solutions.
The text was updated successfully, but these errors were encountered: