However! It has highlighted a problem with the Change node I'm afraid. Alex's node returns true/false which is reasonable. But the Change node doesn't have boolean as an option for the "Search for" element nor does it even have number (though at a push I could perhaps use a regex for that?). Oddly, the "Replace with" field DOES have number but not boolean.
...
I will also raise as a request on Github for NR itself.
...
However! It has highlighted a problem with the Change node I'm afraid. Alex's node returns true/false which is reasonable. But the Change node doesn't have boolean as an option for the "Search for" element nor does it even have number (though at a push I could perhaps use a regex for that?). Oddly, the "Replace with" field DOES have number but not boolean.
if (msg.payload == "true") msg.payload = true;
if (msg.payload == "false") msg.payload = false;--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.
INJECT (1 per minute) --> IS-ONLINE --> CHANGE (true to Online and false to Offline) --> MQTT outINJECT (1 per minute) --> IS-ONLINE (output set to Online/Offline) --> MQTT outINJECT (1 per minute) --> IS-ONLINE --> SWITCH (true = Online and false = Offline) --> MQTT outvar checks = [ {'topic':'SERVICES/NAS/CrashPlan', 'addr': '192.168.0.62:4343'}, {'topic':'SERVICES/NAS/MongoDB', 'addr': '192.168.0.62:27017'}, {'topic':'SERVICES/PI2/MongoDB', 'addr': '192.168.0.67:27017'}, {'topic':'SERVICES/PI2/MQTT-sock', 'addr': '192.168.0.67:9001'}, {'topic':'SERVICES/PI2/MQTT', 'addr': '192.168.0.67:1883'}, {'topic':'SERVICES/ROUTER/Web', 'addr': '192.168.0.1'},];
for ( var i in checks ) { node.send({ 'topic': i.topic, 'url': i.addr });}14/03/2016, 22:16:152155f29c.f5efbemsg : Object{ "_msgid": "da728c62.258d7", "timestamp": 1457993776907, "online": true, "payload": "Online" }Try this... )))
var checks = [ {'topic':'SERVICES/NAS/CrashPlan', 'addr': '192.168.2.64:8000'}, {'topic':'SERVICES/NAS/MongoDB', 'addr': '192.168.0.62:27017'}, {'topic':'SERVICES/PI2/MongoDB', 'addr': '192.168.0.67:27017'}, {'topic':'SERVICES/PI2/MQTT-sock', 'addr': '192.168.0.67:9001'}, {'topic':'SERVICES/PI2/MQTT', 'addr': '192.168.0.67:1883'}, {'topic':'SERVICES/ROUTER/Web', 'addr': '192.168.0.1'},];
for ( var i in checks ) { node.send({ 'topic': checks[i].topic, 'url': checks[i].addr });}... and pull requests are welcome :-)(as long as they don't break the existing functionality)