Created
November 10, 2013 19:25
-
-
Save thiseldo/7402637 to your computer and use it in GitHub Desktop.
A quick CurrentCost to Node-RED function to read each channel and split out to topic/payload. Next node could be to publish to a mqtt topic that has already been defined in this node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = msg.payload; | |
try { | |
msg.topic="ccost/" + result.msg.sensor; | |
msg.payload = (result.msg.ch1[0].watts[0])*1; | |
return msg; | |
} catch( e ) | |
{ | |
// console.log("Looks like history data"); | |
} | |
return null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Every time I search for how to do something I come across something succint written by you!
Thanks for the help.