1
0
Fork 0
ha-config/node-red/flows.json

2 lines
8.1 KiB
JSON

[{"id":"466ad5c2.a29164","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"40da5ad2.8aabf4","type":"tab","label":"Covid-19","disabled":false,"info":""},{"id":"dc09bc1e.a5f7f","type":"server","name":"Home Assistant","addon":true},{"id":"f2eef645.6063f","type":"binance-credentials","name":"Binance Credentials"},{"id":"4f147b45.6d1a5c","type":"http request","z":"40da5ad2.8aabf4","name":"state cases","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://raw.githubusercontent.com/covid-19-au/covid-19-au.github.io/prod/src/data/stateCaseData.json","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":160,"wires":[["d3ee7ba9.942948"]]},{"id":"d3ee7ba9.942948","type":"change","z":"40da5ad2.8aabf4","name":"just victoria data","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.values[2]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":160,"wires":[["30249d2b.adadf2"]]},{"id":"3af185ab.c301b2","type":"ha-entity","z":"40da5ad2.8aabf4","name":"COVID-19","server":"dc09bc1e.a5f7f","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"COVID-19 Data"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:virus"},{"property":"unit_of_measurement","value":""}],"state":"payload[1]","stateType":"msg","attributes":[{"property":"state","value":"payload[0]","valueType":"msg"},{"property":"cases","value":"payload[1]","valueType":"msg"},{"property":"deaths","value":"payload[2]","valueType":"msg"},{"property":"recovered","value":"payload[3]","valueType":"msg"},{"property":"tested","value":"payload[4]","valueType":"msg"},{"property":"active","value":"payload[5]","valueType":"msg"},{"property":"hospital","value":"payload[6]","valueType":"msg"},{"property":"icu","value":"payload[7]","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":970,"y":160,"wires":[[]]},{"id":"366ac0f2.d26968","type":"inject","z":"40da5ad2.8aabf4","name":"","repeat":"3600","crontab":"","once":true,"onceDelay":"30","topic":"","payload":"","payloadType":"date","x":110,"y":160,"wires":[["4f147b45.6d1a5c"]]},{"id":"30249d2b.adadf2","type":"rbe","z":"40da5ad2.8aabf4","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":590,"y":160,"wires":[["3af185ab.c301b2"]]},{"id":"6aaac257.edb40c","type":"http request","z":"40da5ad2.8aabf4","name":"state cases","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://raw.githubusercontent.com/covid-19-au/covid-19-au.github.io/prod/src/data/state.json","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":260,"wires":[["882d669e.5f14c8"]]},{"id":"23c16912.20f496","type":"inject","z":"40da5ad2.8aabf4","name":"","repeat":"3600","crontab":"","once":true,"onceDelay":"30","topic":"","payload":"","payloadType":"date","x":110,"y":260,"wires":[["6aaac257.edb40c"]]},{"id":"482885aa.9fabbc","type":"comment","z":"40da5ad2.8aabf4","name":"Data Source Site","info":"Data source:\nhttps://github.com/covid-19-au/covid-19-au.github.io\n\nVictorian source:\nhttps://interactive.guim.co.uk/covidfeeds/victoria.json","x":100,"y":60,"wires":[]},{"id":"4eeb6da3.14ce6c","type":"ha-entity","z":"40da5ad2.8aabf4","name":"COVID-19 New Cases","server":"dc09bc1e.a5f7f","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"COVID-19 New"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:virus"},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1000,"y":260,"wires":[[]]},{"id":"4141ba11.d94e34","type":"http request","z":"40da5ad2.8aabf4","name":"locale cases","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://interactive.guim.co.uk/covidfeeds/victoria.json","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":460,"wires":[["9f89f5ee.bb3dd8"]]},{"id":"62431127.2d61d","type":"inject","z":"40da5ad2.8aabf4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"30","topic":"","payload":"","payloadType":"date","x":110,"y":460,"wires":[["4141ba11.d94e34"]]},{"id":"9f89f5ee.bb3dd8","type":"change","z":"40da5ad2.8aabf4","name":"locale","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[45]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":460,"wires":[["5a22148b.f4b4ec"]]},{"id":"5a22148b.f4b4ec","type":"rbe","z":"40da5ad2.8aabf4","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":590,"y":460,"wires":[["977b4662.8b88"]]},{"id":"977b4662.8b88","type":"change","z":"40da5ad2.8aabf4","name":"only case count data","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.count","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":460,"wires":[["a95a84ad.096a78"]]},{"id":"a95a84ad.096a78","type":"ha-entity","z":"40da5ad2.8aabf4","name":"COVID-19 Local","server":"dc09bc1e.a5f7f","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"COVID-19 Local"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:home"},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":980,"y":460,"wires":[[]]},{"id":"878cd05b.e1db5","type":"comment","z":"40da5ad2.8aabf4","name":"Edit the above payload [<index>] to change the locale displayed","info":"","x":450,"y":520,"wires":[]},{"id":"882d669e.5f14c8","type":"rbe","z":"40da5ad2.8aabf4","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":590,"y":260,"wires":[["564b2fa5.94e01","6d58927c.e10314"]]},{"id":"564b2fa5.94e01","type":"function","z":"40da5ad2.8aabf4","name":"Get Vic Cases Daily","func":"var total = Object.keys(msg.payload).length;\n//var difference = msg.payload[total-1].VIC-msg.payload[total-2].VIC;\n//return {payload:difference};\n\nvar input = msg.payload;\nvar data = [], date;\n\nfor (date in msg.payload) {\n data.push(date);\n}\n\nvar today = data[data.length-1];// - data[data.length-2];\nvar yesterday = data[data.length-2];\n\nvar result = input[today].VIC[0] - input[yesterday].VIC[0];\n\n//return {payload:msg.payload[total-1]};\nreturn {payload:result};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":260,"wires":[["4eeb6da3.14ce6c"]]},{"id":"6d58927c.e10314","type":"function","z":"40da5ad2.8aabf4","name":"Fortnight Average","func":"var input = msg.payload;\nvar data = [], date;\n\nfor (date in msg.payload) {\n data.push(date);\n}\n\nvar last14days = 0;\n\nfor (i = 1; i < 15; i++)\n{\n last14days += input[data[data.length-i]].VIC[0] - input[data[data.length-i-1]].VIC[0];\n}\n\nvar result = last14days / 14;\n\nreturn {payload:result};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":320,"wires":[["3fc3c1ba.d26796"]]},{"id":"3fc3c1ba.d26796","type":"ha-entity","z":"40da5ad2.8aabf4","name":"Covid Average","server":"dc09bc1e.a5f7f","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Covid Average"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:calendar"},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":980,"y":320,"wires":[[]]},{"id":"5b7c2205.274ebc","type":"binance-get-balance","z":"466ad5c2.a29164","name":"","binance":"f2eef645.6063f","x":460,"y":420,"wires":[["fe301e63.6fe"]]},{"id":"fe301e63.6fe","type":"debug","z":"466ad5c2.a29164","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":400,"wires":[]},{"id":"192d88e5.a61f4f","type":"inject","z":"466ad5c2.a29164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":200,"y":540,"wires":[["5b7c2205.274ebc"]]}]