Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"id":"8e5597e7.a827d8","type":"Blockly","z":"e67976a.0cd2188","language":"en","func":"var oldPayload, j;\n\n\nif (!(msg['previous'])) {\n msg['previous'] = (msg['payload']);\n}\noldPayload = (msg['payload']);\nfor (var j_index in oldPayload) {\n j = oldPayload[j_index];\n msg['payload'] = j;\n delete msg['previous'];\n node.send([msg]);\n}\n","workspaceXml":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"~EodP7S1]h#a78;%DkbV\">oldPayload</variable><variable type=\"\" id=\"A-,$O)LJq:9F9`-d{KHW\">j</variable></variables><block type=\"controls_if\" id=\"4#g`]Rb(8_:om.T,5Yb@\" x=\"38\" y=\"13\"><value name=\"IF0\"><block type=\"logic_negate\" id=\"{H/GxLh*0GKqof~gJ9FH\"><value name=\"BOOL\"><block type=\"node_object_get\" id=\";iY81Pdt)t*71h3ZBoce\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"`1T@SJH.hKc7!FyPR]aD\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"FO8/6)[M4@DWWr4{Ad2x\"><field name=\"TEXT\">previous</field></shadow></value></block></value></block></value><statement name=\"DO0\"><block type=\"node_object_set\" id=\"NqkM2C9zHKxx_*tQJ^T}\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"zx@5ss0r`O.R?+tQ%:;3\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"Sj=va{GM|@_xacLj`{tN\"><field name=\"TEXT\">previous</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\"^0Q0hV|[C._o7g?Yae,!\"><field name=\"TEXT\"></field></shadow><block type=\"node_object_get\" id=\"AFmF9kHxY/.=ES$+KkK$\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"Duq7lLWw/Y4zwzCT!4r4\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"^7D$4cqWh)e/LA)~~er8\"><field name=\"TEXT\">payload</field></shadow></value></block></value></block></statement><next><block type=\"variables_set\" id=\"i~yN/~Zw$RVO.1eU]B=A\"><field name=\"VAR\" id=\"~EodP7S1]h#a78;%DkbV\" variabletype=\"\">oldPayload</field><value name=\"VALUE\"><block type=\"node_object_get\" id=\"Mg`v$qW7?I}#Y/L?lG|u\"><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"H$dI6!R=7nXG=HQYqgJ?\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"QZv0tnU3/$pTD3Pd6|l=\"><field name=\"TEXT\">payload</field></shadow></value></block></value><next><block type=\"controls_forEach\" id=\"56vJ@Z-^Erx8D4K;bN7!\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">j</field><value name=\"LIST\"><block type=\"variables_get\" id=\";l-|X?hDq^9l=Ve[XWr!\"><field name=\"VAR\" id=\"~EodP7S1]h#a78;%DkbV\" variabletype=\"\">oldPayload</field></block></value><statement name=\"DO\"><block type=\"node_object_set\" id=\"NT~7:QP@~f/a(rjy.,;(\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"UA+1dRwfKNG.u?E~U+:b\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"c4Q+s!l/P4gM#*U4sF9?\"><field name=\"TEXT\">payload</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\"EKojmLy3L+0^$`90}8w,\"><field name=\"TEXT\"></field></shadow><block type=\"variables_get\" id=\":=8TsuFMg4B8u*j8|LGD\"><field name=\"VAR\" id=\"A-,$O)LJq:9F9`-d{KHW\" variabletype=\"\">j</field></block></value><next><block type=\"node_object_get\" id=\"b@hi7$f-Oz7wS,Z/)5?B\"><field name=\"action\">REMOVE</field><value name=\"object\"><shadow type=\"node_msg\" id=\"*MzoWr~h1_CU/7V39~.;\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\")9#L)`g~u_yB/km|^,}3\"><field name=\"TEXT\">previous</field></shadow></value><next><block type=\"node_send\" id=\"^_BS6]GsDL.Gg#~iUpy/\"><field name=\"OUTPUT_NR\">1</field><value name=\"MESSAGE_INPUT\"><shadow type=\"node_msg\" id=\"?2}KHM=L8EH/9Gz0v2g3\"></shadow></value></block></next></block></next></block></statement></block></next></block></next></block></xml>","outputs":1,"name":"","x":460,"y":140,"wires":[["b769bcb8.86784"]]},{"id":"5ef60bc5.bb7fc4","type":"inject","z":"e67976a.0cd2188","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\":\"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\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":140,"wires":[["8e5597e7.a827d8"]]},{"id":"b769bcb8.86784","type":"debug","z":"e67976a.0cd2188","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":650,"y":140,"wires":[]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement