Skip to content

Instantly share code, notes, and snippets.

@timanrebel
Created February 16, 2020 21:26
Show Gist options
  • Save timanrebel/c7e7df7af053d92d73b5872dd819871c to your computer and use it in GitHub Desktop.
Save timanrebel/c7e7df7af053d92d73b5872dd819871c to your computer and use it in GitHub Desktop.
iSpindel Node Red redistribution to brew father, brewer's friend and brewpi. Including minor dashboard
[{"id":"d6eba550.f7c5e","type":"tab","label":"iSpindel","disabled":false,"info":""},{"id":"46b76906.55c778","type":"tcp in","z":"d6eba550.f7c5e","name":"","server":"server","host":"","port":"8000","datamode":"single","datatype":"utf8","newline":",","topic":"ispindel","base64":false,"x":75,"y":189,"wires":[["dff2ea4a.2b706","3a0f71a8.a39be6"]]},{"id":"dff2ea4a.2b706","type":"json","z":"d6eba550.f7c5e","name":"","property":"payload","action":"","pretty":false,"x":235,"y":146,"wires":[["90a7fe17.eeb118"]]},{"id":"1b48e441.a7ab14","type":"ui_chart","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":2,"width":"19","height":"9","label":"Temperature ºC","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"-10","ymax":"30","removeOlder":"3","removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#e53b3c","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":918,"y":306,"wires":[["91682420.cc0f58"],[]]},{"id":"17485e18.e0412a","type":"function","z":"d6eba550.f7c5e","name":"Split data","func":"\nvar keys = Object.keys(msg.payload);\n\nvar msgs = keys.map(function(key) {\n return { topic: key, payload: msg.payload[key] };\n});\nreturn [msgs];\n","outputs":1,"noerr":0,"x":350,"y":322,"wires":[["dc6207ea.012b4"]]},{"id":"dc6207ea.012b4","type":"switch","z":"d6eba550.f7c5e","name":"router","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"angle","vt":"str"},{"t":"eq","v":"temperature","vt":"str"},{"t":"eq","v":"gravity","vt":"str"},{"t":"eq","v":"battery","vt":"str"},{"t":"eq","v":"RSSI","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":490,"y":320,"wires":[["55c1b103.234bc8","38cd83cf.d8b0cc"],["1b48e441.a7ab14","552f1a2f.cef2e4"],["f194cddc.9e0ac","4b2e6f40.41d888"],["57accaaf.b8f064","275691c9.3f3f5e"],["83d3ea25.5ea4d8"]]},{"id":"9810da47.54e93","type":"ui_gauge","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":5,"width":"5","height":"4","gtype":"gage","title":"Battery","label":"%","format":"{{value | number:1}}","min":"0","max":"100","colors":["#e32400","#e6e600","#77bb40"],"seg1":"10","seg2":"20","x":897,"y":426,"wires":[]},{"id":"c1e7c61e.b0e758","type":"inject","z":"d6eba550.f7c5e","name":"Clean Dashboard","topic":"","payload":"[]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":701,"y":147,"wires":[["1b48e441.a7ab14","9810da47.54e93","c92b7676.94587","38cd83cf.d8b0cc"]]},{"id":"275691c9.3f3f5e","type":"debug","z":"d6eba550.f7c5e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":682,"wires":[]},{"id":"55c1b103.234bc8","type":"ui_gauge","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":4,"width":"5","height":"4","gtype":"gage","title":"Angle","label":"º","format":"{{value | number:2}}","min":"40","max":"90","colors":["#00a3d8","#00a3d8","#00a3d8"],"seg1":"","seg2":"","x":886,"y":466,"wires":[]},{"id":"177524e2.68599b","type":"homekit-service","z":"d6eba550.f7c5e","bridge":"aedc8b7.e5cb378","name":"iSpindel Temperature","serviceName":"TemperatureSensor","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":834.5,"y":665,"wires":[[]]},{"id":"afb5970a.ccd75","type":"inject","z":"d6eba550.f7c5e","name":"Test","topic":"","payload":"{\"name\":\"Red\",\"ID\":11756011,\"angle\":76.36908,\"temperature\":23.9375,\"battery\":4.056309,\"gravity\":76.36908,\"interval\":300,\"RSSI\":-69}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":79.5,"y":142,"wires":[["dff2ea4a.2b706"]]},{"id":"c92b7676.94587","type":"ui_chart","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":1,"width":"19","height":"9","label":"Gravity","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"SG","dot":false,"ymin":"0.970","ymax":"1.090","removeOlder":"3","removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":899.5,"y":344,"wires":[["3c72bcbb.a328e4"],[]]},{"id":"83d3ea25.5ea4d8","type":"ui_gauge","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":6,"width":"5","height":"4","gtype":"gage","title":"RSSI","label":"dBm","format":"{{value | number:0}}","min":"-100","max":"-30","colors":["#b51a00","#e6e600","#669d34"],"seg1":"-80","seg2":"-67","x":886.5,"y":509,"wires":[]},{"id":"552f1a2f.cef2e4","type":"function","z":"d6eba550.f7c5e","name":"Convert to Homekit","func":"msg.payload = {\n \"CurrentTemperature\": parseFloat(msg.payload),\n \"StatusActive\": true\n}\nreturn msg;","outputs":1,"noerr":0,"x":624.5,"y":665,"wires":[["177524e2.68599b"]]},{"id":"f194cddc.9e0ac","type":"function","z":"d6eba550.f7c5e","name":"Convert to Homekit","func":"msg.payload = {\n CurrentTemperature: parseFloat((msg.payload*1000)-1000)\n}\nreturn msg;","outputs":1,"noerr":0,"x":625.5,"y":710,"wires":[["4f473cae.82be44"]]},{"id":"4f473cae.82be44","type":"homekit-service","z":"d6eba550.f7c5e","bridge":"aedc8b7.e5cb378","name":"iSpindel Gravtiy","serviceName":"TemperatureSensor","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":822.5,"y":710,"wires":[[]]},{"id":"3c72bcbb.a328e4","type":"persist in","z":"d6eba550.f7c5e","name":"Gravity","storageNode":"4d3a349d.90bcc4","x":1082.5,"y":343,"wires":[]},{"id":"91682420.cc0f58","type":"persist in","z":"d6eba550.f7c5e","name":"Temperature","storageNode":"4d3a349d.90bcc4","x":1093.5,"y":303,"wires":[]},{"id":"eaf96945.159d38","type":"persist out","z":"d6eba550.f7c5e","name":"Gravity","storageNode":"4d3a349d.90bcc4","x":907.5,"y":227,"wires":[["c92b7676.94587"]]},{"id":"2b637903.50830e","type":"persist out","z":"d6eba550.f7c5e","name":"Temperature","storageNode":"4d3a349d.90bcc4","x":919.5,"y":184,"wires":[["1b48e441.a7ab14"]]},{"id":"38cd83cf.d8b0cc","type":"ui_chart","z":"d6eba550.f7c5e","name":"","group":"90bfe9ea.7a7fa8","order":3,"width":"19","height":"9","label":"Angle Line","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"90","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":908.5,"y":267,"wires":[["d3260a5f.79af28"],[]]},{"id":"d3260a5f.79af28","type":"persist in","z":"d6eba550.f7c5e","name":"Angle","storageNode":"4d3a349d.90bcc4","x":1073.5,"y":267,"wires":[]},{"id":"1c538159.065cef","type":"persist out","z":"d6eba550.f7c5e","name":"Angle","storageNode":"4d3a349d.90bcc4","x":901.5,"y":145,"wires":[["38cd83cf.d8b0cc"]]},{"id":"ff68daba.21ea28","type":"http request","z":"d6eba550.f7c5e","name":"Brewer's Friend","method":"POST","ret":"txt","url":"https://log.brewersfriend.com/ispindel/XXX","tls":"","x":340.5,"y":641,"wires":[[]]},{"id":"37de01f8.43986e","type":"debug","z":"d6eba550.f7c5e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":342.5,"y":427,"wires":[]},{"id":"90a7fe17.eeb118","type":"function","z":"d6eba550.f7c5e","name":"Calibrate SG","func":"var tilt = msg.payload.angle;\n\nmsg.payload.gravity = 0.000009664*(tilt*tilt*tilt) + -0.001272983*(tilt*tilt) + 0.057098818*tilt + 0.134318693;\n\nreturn msg;","outputs":1,"noerr":0,"x":118.5,"y":332,"wires":[["17485e18.e0412a","c972796f.c76fa8","37de01f8.43986e","9cdd3a4e.692ec"]]},{"id":"c972796f.c76fa8","type":"function","z":"d6eba550.f7c5e","name":"SG to Plato","func":"var gravity = msg.payload.gravity;\nvar plato = 259 - (259/gravity);\n\nmsg.payload.gravity = plato;\n\nreturn msg;","outputs":1,"noerr":0,"x":109.5,"y":640,"wires":[["ff68daba.21ea28","c64e4a1.e433038"]]},{"id":"4b2e6f40.41d888","type":"function","z":"d6eba550.f7c5e","name":"Round gravity","func":"msg.payload.toFixed(4);\n\nreturn msg;","outputs":1,"noerr":0,"x":714.5,"y":343,"wires":[["c92b7676.94587"]]},{"id":"c64e4a1.e433038","type":"http request","z":"d6eba550.f7c5e","name":"Brewfather","method":"POST","ret":"txt","paytoqs":false,"url":"http://log.brewfather.net/ispindel?id=XXX","tls":"","proxy":"","authType":"","x":333.5,"y":596,"wires":[[]]},{"id":"57accaaf.b8f064","type":"function","z":"d6eba550.f7c5e","name":"Battery %","func":"var x = msg.payload;\n\nvar perc = ((x-2.9)/1.3)*100\n\nmsg.payload = perc;\n\nreturn msg;","outputs":1,"noerr":0,"x":723.5,"y":425,"wires":[["9810da47.54e93","275691c9.3f3f5e"]]},{"id":"3a0f71a8.a39be6","type":"debug","z":"d6eba550.f7c5e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":250,"y":189,"wires":[]},{"id":"9cdd3a4e.692ec","type":"http request","z":"d6eba550.f7c5e","name":"Brewpi","method":"POST","ret":"txt","paytoqs":false,"url":"http://XXX:5080/ispindel/ispindel","tls":"","proxy":"","authType":"","x":326,"y":549,"wires":[[]]},{"id":"90bfe9ea.7a7fa8","type":"ui_group","z":"","name":"Ispindel","tab":"56f6801e.919408","disp":true,"width":"24","collapse":false},{"id":"aedc8b7.e5cb378","type":"homekit-bridge","z":"","bridgeName":"NodeRED","pinCode":"111-11-111","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"},{"id":"4d3a349d.90bcc4","type":"persist-store","z":"","filename":"persistance.json","interval":"300"},{"id":"56f6801e.919408","type":"ui_tab","z":"","name":"iSpindel","icon":"dashboard"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment