My implementation of Grovestreams via Node Red

After some scrabbling around I've strung my CAD Stick data through Node Red (used IBM's free cloud version) to Grovestreams (also free for basic use). As I already collect my Smartthings data there, this is a one stop shop for all household data... nice.

Comments

  • My Node Red implementation using sidepipe's (thank you sidepipe!) Domoticz interface. For some reason I couldn't get the Grovestreams node to work (from Scargill), so I used a standard http node and generated my own json (after some fumbling with Postman).

    1. Open the Hildebrand node and set your topic (replace SETYOURTOPIC), then open the connector and set your username and password
    2. Open the http request and put your API key in the URL and your username and password (basic auth) for Grovestreams in

    I've left the Update Export and Grid Power in in case anyone uses them - perhaps I will in the future.

    I used IBM's cloud to host this - it's brilliant and completely free (not even a credit card required). I used a guide on hackernoon (search google for "hackernoon hw5d3220")

    Will post the Node Red code next

    HTH,

    Duncan

  • [{"id":"709ab88d.e3f598","type":"tab","label":"GlowCAD Data Import","disabled":false,"info":""},{"id":"d6d9ff06.e3217","type":"mqtt-broker","z":"","name":"Glowmarkt","broker":"glowmqtt.energyhive.com","port":"8883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"fd51dcbf.82e24","type":"mqtt-broker","z":"","name":"Domoticz Control","broker":"127.0.0.1","port":"1883","tls":"54e8b83a.3f1dc8","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b57343fb.40eba","type":"mqtt-broker","z":"","name":"Hildebrand Encrypted MQTT","broker":"glowmqtt.energyhive.com","port":"8883","tls":"54e8b83a.3f1dc8","clientid":"","usetls":true,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"54e8b83a.3f1dc8","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":true},{"id":"c89d9729.dfa598","type":"websocket-client","z":"","path":"grovestreams.com","tls":"","wholemsg":"false"},{"id":"bd78f85e.a08038","type":"mqtt-broker","z":"","name":"Domoticz Control","broker":"127.0.0.1","port":"1883","tls":"cae6b3a8.2e3dc","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"458050e2.35631","type":"mqtt-broker","z":"","name":"Hildebrand Encrypted MQTT","broker":"glowmqtt.energyhive.com","port":"8883","tls":"cae6b3a8.2e3dc","clientid":"","usetls":true,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cae6b3a8.2e3dc","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":true},{"id":"84b3add0.f2748","type":"function","z":"709ab88d.e3f598","name":"Update Electricity","func":"var inData = msg.payload;\nmsg.payload = [{\n    \"compId\": \"meters\",\n    \"streamId\": \"elec\",\n    \"data\": inData[\"idemand\"]\n}];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":710,"y":140,"wires":[["3d01d051.d7ae8","e9910e54.7653d"]]},{"id":"3d01d051.d7ae8","type":"debug","z":"709ab88d.e3f598","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":140,"wires":[]},{"id":"e953c2a1.da742","type":"function","z":"709ab88d.e3f598","name":"Update Gas","func":"var inData = msg.payload;\nmsg.payload = [{\n    \"compId\": \"meters\",\n    \"streamId\": \"gas\",\n    \"data\": inData[\"cgas\"]\n}];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":320,"wires":[["e9910e54.7653d","69578151.7ad18"]]},{"id":"cb358df9.82967","type":"function","z":"709ab88d.e3f598","name":"Update Export","func":"var inData = msg.payload;\n\nmsg.payload = {\n    \"command\": \"udevice\",\n    \"idx\": 1658,\n    \"nvalue\": 0,\n    \"svalue\": inData[\"iexport\"] + \";\" + inData[\"export\"]\n};\n    \nreturn msg;","outputs":1,"noerr":0,"x":700,"y":200,"wires":[[]]},{"id":"54352f7f.0b13d","type":"function","z":"709ab88d.e3f598","name":"Extract Data","func":"var elec = msg.payload.elecMtr;\nvar gas = msg.payload.gasMtr;\nvar eMetering = elec[\"0702\"];\nvar watth = parseInt(eMetering[\"00\"][\"00\"], 16);\nvar idemand = parseInt(eMetering[\"04\"][\"00\"], 16);\nvar iexport = 0;\nif(idemand > 0x80000000) {\n    iexport = -(idemand - 0x100000000);\n    idemand = 0;\n}\nvar out = parseInt(eMetering[\"00\"][\"01\"], 16);\nvar curgas = parseInt(gas[\"0702\"][\"00\"][\"00\"], 16);\nmsg.payload = {\n    \"current\":watth,\n    \"export\":out,\n    \"idemand\":idemand,\n    \"iexport\":iexport,\n    \"isigned\":idemand - iexport,\n    \"cgas\": curgas\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":240,"wires":[["84b3add0.f2748","e953c2a1.da742","cb358df9.82967","28320927.213806"]]},{"id":"ef23cee0.57241","type":"mqtt in","z":"709ab88d.e3f598","name":"Hildebrand SMQTT","topic":"SMART/HILD/SETYOURTOPIC","qos":"2","datatype":"utf8","broker":"458050e2.35631","x":370,"y":360,"wires":[["b58072e6.3d395"]]},{"id":"28320927.213806","type":"function","z":"709ab88d.e3f598","name":"Update Grid Power","func":"var inData = msg.payload;\n\nmsg.payload = {\n    \"command\": \"setuservariable\",\n    \"idx\": 42,\n    \"value\": inData[\"isigned\"]\n};\n    \nreturn msg;","outputs":1,"noerr":0,"x":710,"y":260,"wires":[[]]},{"id":"154af569.caaabb","type":"http request","z":"709ab88d.e3f598","name":"","method":"PUT","ret":"obj","paytoqs":"ignore","url":"http://grovestreams.com:80/api/feed?api_key=YOURGROVESTREAMSAPIKEY","tls":"","persist":false,"proxy":"","authType":"basic","x":950,"y":280,"wires":[["967093d.d22547"]]},{"id":"e9910e54.7653d","type":"function","z":"709ab88d.e3f598","name":"","func":"msg.headers = {};\nmsg.headers['content-type'] = 'application/json';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":950,"y":220,"wires":[["154af569.caaabb"]]},{"id":"967093d.d22547","type":"debug","z":"709ab88d.e3f598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":340,"wires":[]},{"id":"b58072e6.3d395","type":"json","z":"709ab88d.e3f598","name":"","property":"payload","action":"obj","pretty":false,"x":420,"y":300,"wires":[["54352f7f.0b13d"]]},{"id":"69578151.7ad18","type":"debug","z":"709ab88d.e3f598","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":380,"wires":[]}]

Sign In or Register to comment.