Advertisement
cymplecy

Untitled

Sep 1st, 2018
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 16.03 KB | None | 0 0
  1. [{"id":"7e89d28.920802c","type":"inject","z":"1782e6fc.4d05a9","name":"","topic":"","payload":"{\"Living Room\":{\"id\":1,\"Name\":\"Living Room\",\"CurrentTemperature\":17.5,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Kitchen\":{\"id\":2,\"Name\":\"Kitchen\",\"CurrentTemperature\":17.7,\"DesiredTemperature\":-20,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Dining Room\":{\"id\":3,\"Name\":\"Dining Room\",\"CurrentTemperature\":18.1,\"DesiredTemperature\":18,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Rear Hall\":{\"id\":4,\"Name\":\"Rear Hall\",\"CurrentTemperature\":19.5,\"DesiredTemperature\":16,\"Heating\":\"On\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Front Hall\":{\"id\":5,\"Name\":\"Front Hall\",\"CurrentTemperature\":18,\"DesiredTemperature\":17,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Master Bedroom\":{\"id\":6,\"Name\":\"Master Bedroom\",\"CurrentTemperature\":16.9,\"DesiredTemperature\":15,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"James Bedroom\":{\"id\":7,\"Name\":\"James Bedroom\",\"CurrentTemperature\":18.8,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Libby Bedroom\":{\"id\":8,\"Name\":\"Libby Bedroom\",\"CurrentTemperature\":18.6,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Loft main\":{\"id\":9,\"Name\":\"Loft main\",\"CurrentTemperature\":-3276.8,\"DesiredTemperature\":15,\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Loft box\":{\"id\":10,\"Name\":\"Loft box\",\"CurrentTemperature\":-3276.8,\"DesiredTemperature\":16,\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":120,"wires":[["ba861c5d.688cb"]]},{"id":"5228f6b2.d22a98","type":"debug","z":"1782e6fc.4d05a9","name":"OUTPUT1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":40,"wires":[]},{"id":"411d940d.bc37bc","type":"Blockly","z":"1782e6fc.4d05a9","language":"en","func":"var roomKeys, room, this2, last, newMsg;\n\n\nif (!(msg['previous'])) {\n  msg['previous'] = (msg['payload']);\n}\nroomKeys = Object.keys((msg['payload']));\nnode.status({fill:\"blue\", shape:\"ring\", text:roomKeys});\nfor (var room_index in roomKeys) {\n  room = roomKeys[room_index];\n  this2 = ((msg['payload'])[room]);\n  last = ((msg['previous'])[room]);\n  if ((this2['Heating']) != (last['Heating'])) {\n    newMsg = ({});\n    newMsg['topic'] = 'Room Change';\n    newMsg['payload'] = (JSON.parse(([['{\"change\":\"',(this2['Heating']),'\",'].join(''),['\"time\":\"',(msg['date']),'\",\"'].join(''),[room,'\":',(JSON.stringify(this2)),'}'].join('')].join(''))));\n    node.send([null, newMsg]);\n  }\n}\nreturn [msg, null];\n","workspaceXml":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"UibbM2mTlaxp-},bN5N^\">roomKeys</variable><variable type=\"\" id=\"A-,$O)LJq:9F9`-d{KHW\">room</variable><variable type=\"\" id=\"$)wRf.?H6^IJ;Z4.pYvq\">this</variable><variable type=\"\" id=\"ga;t@5fSL3h/{A-$r:ss\">last</variable><variable type=\"\" id=\"7PKg}L:UExPwN(V5zL1a\">newMsg</variable></variables><block type=\"controls_if\" id=\"TAJlc^sZ%2-8FI+z|Det\" x=\"13\" y=\"13\"><value name=\"IF0\"><block type=\"logic_negate\" id=\".iuo?GFtL~(~=y+WJ!x+\"><value name=\"BOOL\"><block type=\"node_object_get\" id=\"52*zaQuW41gH!_i7Nq_6\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"y;ai.oH$EG*gHKN4KW#G\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"SgX(Me;4S)P7l[wFCdD`\"><field name=\"TEXT\">previous</field></shadow></value></block></value></block></value><statement name=\"DO0\"><block type=\"node_object_set\" id=\"oZ`e7cSxtn~nA07mf+vO\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"iUU_=ok`w{Cgy+~0ZSU~\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"%#|z^;*blk71-NN/FjF2\"><field name=\"TEXT\">previous</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\";}?[?z?B1_nfbvt2tFNT\"><field name=\"TEXT\"></field></shadow><block type=\"node_object_get\" id=\"BZ7|lf.pPp(CAs3}`3F8\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"u~sQspo+3cDOAqm?{|1b\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"42XSR#r_ku(,S+RKxziY\"><field name=\"TEXT\">payload</field></shadow></value></block></value></block></statement><next><block type=\"variables_set\" id=\"!H8U[4@~{pG]U}{rp0~m\"><field name=\"VAR\" id=\"UibbM2mTlaxp-},bN5N^\" variabletype=\"\">roomKeys</field><value name=\"VALUE\"><block type=\"object_keys\" id=\"vpwSz2bNnam#SC~%q~C3\"><value name=\"object_input\"><shadow type=\"node_msg\" id=\"0R)Y$ab|yTCGXg$BxfUV\"></shadow><block type=\"node_object_get\" id=\"yHqd(`20g{NumpPkDolg\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"p[l|sEpY93_Xf$;QS((C\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"Cq!6qn1M.aSmLOfoPYP3\"><field name=\"TEXT\">payload</field></shadow></value></block></value></block></value><next><block type=\"node_status\" id=\"9Rl|)$i}A@At_fo:L!wW\"><field name=\"COLOUR\">#0000FF</field><field name=\"SHAPE\">RING</field><value name=\"TEXT_INPUT\"><shadow type=\"text\" id=\"Q*wIa~P?t#8qE/Z]nqDU\"><field name=\"TEXT\"></field></shadow><block type=\"variables_get\" id=\"h|)@xbi}NgR*xZAzrgyD\"><field name=\"VAR\" id=\"UibbM2mTlaxp-},bN5N^\" variabletype=\"\">roomKeys</field></block></value><next><block type=\"controls_forEach\" id=\"U-*tOI]w~e7Arl#T1X-g\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">room</field><value name=\"LIST\"><block type=\"variables_get\" id=\"D2DrK3a^j{eat##c;G=C\"><field name=\"VAR\" id=\"UibbM2mTlaxp-},bN5N^\" variabletype=\"\">roomKeys</field></block></value><statement name=\"DO\"><block type=\"variables_set\" id=\"IiyEz]ibt#AmxFWB=KO1\"><field name=\"VAR\" id=\"$)wRf.?H6^IJ;Z4.pYvq\" variabletype=\"\">this</field><value name=\"VALUE\"><block type=\"node_object_get\" id=\"]CnOFkjoKg)I4xt)8E`$\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"EH{9Xr=Z:1P~_R:E^xZ3\"></shadow><block type=\"node_object_get\" id=\"[H-Dl36^(S}?cc)58o.3\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"{OZ63rAN;}3@|~5!ZzWZ\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"*^F}-8fSyzJL$|L4zcSf\"><field name=\"TEXT\">payload</field></shadow></value></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"Ps4H57|hn{%gr|6$D*=-\"><field name=\"TEXT\">payload</field></shadow><block type=\"variables_get\" id=\"tH=rF{:uWI,.f3;]!%6h\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">room</field></block></value></block></value><next><block type=\"variables_set\" id=\"H0HilBR5{ZHt3~9K`P/]\"><field name=\"VAR\" id=\"ga;t@5fSL3h/{A-$r:ss\" variabletype=\"\">last</field><value name=\"VALUE\"><block type=\"node_object_get\" id=\"o$H+bS[(oL@7{+LD#GBE\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"EH{9Xr=Z:1P~_R:E^xZ3\"></shadow><block type=\"node_object_get\" id=\"32Omq-^Bu{XvEeF!+Rs3\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"qN!]GeYeOs+Y3fy4K:gd\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"2J4jNQ(O[u7WZg2U$~45\"><field name=\"TEXT\">previous</field></shadow></value></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"Ps4H57|hn{%gr|6$D*=-\"><field name=\"TEXT\">payload</field></shadow><block type=\"variables_get\" id=\"MD?!b+.WyM`GMt5X5h0e\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">room</field></block></value></block></value><next><block type=\"controls_if\" id=\"X@_6Lah8y-2A:Ls.h|#5\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"[?c7o1X$@_8#jN-e^VB}\"><field name=\"OP\">NEQ</field><value name=\"A\"><block type=\"node_object_get\" id=\"`T$$#I3i0!WubXS:ioJm\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"~Q7AyX:NjqRcDZnQpt4E\"></shadow><block type=\"variables_get\" id=\"}2qvr+!S?*OBB0t581)|\"><field name=\"VAR\" id=\"$)wRf.?H6^IJ;Z4.pYvq\" variabletype=\"\">this</field></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"XV#V0l$rBk0$@@]02s1Q\"><field name=\"TEXT\">Heating</field></shadow></value></block></value><value name=\"B\"><block type=\"node_object_get\" id=\"TDxaHM5|m^G{^MgjA+3z\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"~Q7AyX:NjqRcDZnQpt4E\"></shadow><block type=\"variables_get\" id=\"d=lDE.;*wDk1!_SpzYd5\"><field name=\"VAR\" id=\"ga;t@5fSL3h/{A-$r:ss\" variabletype=\"\">last</field></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"?_oK^Vdz;?!Ltd]Q27R^\"><field name=\"TEXT\">Heating</field></shadow></value></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"a[D^:t2O+DMn8e.qZ45F\"><field name=\"VAR\" id=\"7PKg}L:UExPwN(V5zL1a\" variabletype=\"\">newMsg</field><value name=\"VALUE\"><block type=\"object_create\" id=\"ixC%aO_ub!NhnsCfM0*z\"></block></value><next><block type=\"node_object_set\" id=\"8%HvBw(qb67V+Fs-I|3j\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"!}{-_Q)a7Bk@cf9BVIbS\"></shadow><block type=\"variables_get\" id=\"XvWdoU#z(e7IORI0+JX3\"><field name=\"VAR\" id=\"7PKg}L:UExPwN(V5zL1a\" variabletype=\"\">newMsg</field></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"*@[osYAx^vOofOfg6|O-\"><field name=\"TEXT\">topic</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\"9An$0jU{A`/2Dc~DFbEH\"><field name=\"TEXT\">Room Change</field></shadow></value><next><block type=\"node_object_set\" id=\"(%j*+W}Z(ArNsN$v^Y#p\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"!}{-_Q)a7Bk@cf9BVIbS\"></shadow><block type=\"variables_get\" id=\"qwM9dTo-e0p-c@%|_D43\"><field name=\"VAR\" id=\"7PKg}L:UExPwN(V5zL1a\" variabletype=\"\">newMsg</field></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"*b4[Y.*}sK{D:issbz6=\"><field name=\"TEXT\">payload</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\"y^!GZJab+h(S`A6r4sjB\"><field name=\"TEXT\">Room Change</field></shadow><block type=\"object_from_json\" id=\"%LrBL4i{.I26JCy!k,;K\"><value name=\"JSON\"><shadow type=\"text\" id=\"`L,LGm|XEsWKFZEiCOk)\"><field name=\"TEXT\">{\"change\":\"xoff\"}</field></shadow><block type=\"text_join\" id=\"_F|l)0E[L:U3=d6$`DNz\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text_join\" id=\"k_QC^3#J4-v$jOurU(L6\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\" id=\"Qb.,lA0yQ/X3dP1}d?A5\"><field name=\"TEXT\">{\"change\":\"</field></block></value><value name=\"ADD1\"><block type=\"node_object_get\" id=\"y#X`=D5rYYmrgT@GfsJ|\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"~Q7AyX:NjqRcDZnQpt4E\"></shadow><block type=\"variables_get\" id=\"ShmWM/Adv,gSi=]V6/,#\"><field name=\"VAR\" id=\"$)wRf.?H6^IJ;Z4.pYvq\" variabletype=\"\">this</field></block></value><value name=\"field_name\"><shadow type=\"text\" id=\"|qNrRuq`|%7QwHdY=)Y9\"><field name=\"TEXT\">Heating</field></shadow></value></block></value><value name=\"ADD2\"><block type=\"text\" id=\"Oa[Sn`K?7cYXmNc{wW1u\"><field name=\"TEXT\">\",</field></block></value></block></value><value name=\"ADD1\"><block type=\"text_join\" id=\"dTFI;2SUQ!W@G*i2Kt7;\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\" id=\"|{Z@!])3p}Qe;US?mDv*\"><field name=\"TEXT\">\"time\":\"</field></block></value><value name=\"ADD1\"><block type=\"node_object_get\" id=\"QQY*Fob$n^#X#E$EOw]=\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"~Q7AyX:NjqRcDZnQpt4E\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"{+B{D6jps,rbSIt%9n9!\"><field name=\"TEXT\">date</field></shadow></value></block></value><value name=\"ADD2\"><block type=\"text\" id=\"-1n-6f(.gDJo2l:9jf)`\"><field name=\"TEXT\">\",\"</field></block></value></block></value><value name=\"ADD2\"><block type=\"text_join\" id=\"O0Knp2O+1[4(%GuJ?[?K\"><mutation items=\"4\"></mutation><value name=\"ADD0\"><block type=\"variables_get\" id=\"ng?J5{ZU@/^yi6U%Atk]\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">room</field></block></value><value name=\"ADD1\"><block type=\"text\" id=\"[8A.%tl(d|_ms!GjdsXK\"><field name=\"TEXT\">\":</field></block></value><value name=\"ADD2\"><block type=\"object_to_json\" id=\"[yCPYoo-urv`=/u::|/f\"><value name=\"object\"><block type=\"variables_get\" id=\"wI#cZ+Zw=#ovhQ!hxZdy\"><field name=\"VAR\" id=\"$)wRf.?H6^IJ;Z4.pYvq\" variabletype=\"\">this</field></block></value></block></value><value name=\"ADD3\"><block type=\"text\" id=\"O9@lxCm+gtI6]MuFr6*V\"><field name=\"TEXT\">}</field></block></value></block></value></block></value></block></value><next><block type=\"node_send\" id=\"8hvk1f+;hJa3hTC8s_(v\"><field name=\"OUTPUT_NR\">2</field><value name=\"MESSAGE_INPUT\"><shadow type=\"node_msg\" id=\"-(tu?$;0Nx^Ck,o7nK60\"></shadow><block type=\"variables_get\" id=\"qj0AH*cNc;HgJZ`uZ;rn\"><field name=\"VAR\" id=\"7PKg}L:UExPwN(V5zL1a\" variabletype=\"\">newMsg</field></block></value></block></next></block></next></block></next></block></statement></block></next></block></next></block></statement><next><block type=\"node_return_message\" id=\"W5@(t9ctv!J86`0JJ0tU\"><field name=\"OUTPUT_NR\">1</field><value name=\"MESSAGE_INPUT\"><shadow type=\"node_msg\" id=\"Ao9UXiSzr+iuR8KI7nD%\"></shadow></value></block></next></block></next></block></next></block></next></block></xml>","outputs":2,"name":"","x":680,"y":120,"wires":[["5228f6b2.d22a98"],["b84540d9.ea7a7"]]},{"id":"ba861c5d.688cb","type":"change","z":"1782e6fc.4d05a9","name":"","rules":[{"t":"set","p":"previous","pt":"msg","to":"{\"Living Room\":{\"id\":1,\"Name\":\"Living Room\",\"CurrentTemperature\":17.5,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Kitchen\":{\"id\":2,\"Name\":\"Kitchen\",\"CurrentTemperature\":17.7,\"DesiredTemperature\":-20,\"Heating\":\"On\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Dining Room\":{\"id\":3,\"Name\":\"Dining Room\",\"CurrentTemperature\":18.1,\"DesiredTemperature\":18,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Rear Hall\":{\"id\":4,\"Name\":\"Rear Hall\",\"CurrentTemperature\":19.5,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Front Hall\":{\"id\":5,\"Name\":\"Front Hall\",\"CurrentTemperature\":18,\"DesiredTemperature\":17,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Master Bedroom\":{\"id\":6,\"Name\":\"Master Bedroom\",\"CurrentTemperature\":16.9,\"DesiredTemperature\":15,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"James Bedroom\":{\"id\":7,\"Name\":\"James Bedroom\",\"CurrentTemperature\":18.8,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Libby Bedroom\":{\"id\":8,\"Name\":\"Libby Bedroom\",\"CurrentTemperature\":18.6,\"DesiredTemperature\":16,\"Heating\":\"Off\",\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Loft main\":{\"id\":9,\"Name\":\"Loft main\",\"CurrentTemperature\":-3276.8,\"DesiredTemperature\":15,\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"},\"Loft box\":{\"id\":10,\"Name\":\"Loft box\",\"CurrentTemperature\":-3276.8,\"DesiredTemperature\":16,\"Override\":\"No\",\"OverrideTimeout\":\"N/A\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":120,"wires":[["8cff47ce.fea768"]]},{"id":"8cff47ce.fea768","type":"function","z":"1782e6fc.4d05a9","name":"Add msg.date","func":"msg.date = new Date()\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":120,"wires":[["411d940d.bc37bc"]]},{"id":"b84540d9.ea7a7","type":"debug","z":"1782e6fc.4d05a9","name":"OUTPUT2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":100,"wires":[]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement