This is (yet) another flow.
Slight modification to the other one.
This one has two different ways of showing the output.
The 1
, 2
, 3
and 4
outputs are the bigger message. Not really useful/needed on the chart
node.
The a
, b
, c
and d
outputs are just the payload
. The topic
is shown too.
Any blocked parts get a 0
and so you can use a join
node and tell it to wait for 4 messages then send the message to the chart
. That is in keeping with what you did before.
You may not need to do that. I don't know.
But here is the slightly better flow:
[{"id":"fb40c7a6.d7dad8","type":"function","z":"b9924a74.4d98f8","name":"","func":"msg = {\"topic\":\"ATESTEO/Wolfsburg/W16\",\"payload\":{\"MQTTWert1\":\"25.1\",\"MQTTWert1name\":\"T_BoxenLuft\",\"MQTTWert2\":\"-101\",\"MQTTWert2name\":\"N_EMA_VL\",\"MQTTWert3\":\"932\",\"MQTTWert3name\":\"n_Antrieb\",\"MQTTWert4\":\"269\",\"MQTTWert4name\":\"M_Antrieb\",\"Status\":\"Läuft\"},\"qos\":1,\"retain\":false,\"_topic\":\"ATESTEO/Wolfsburg/W16\",\"_msgid\":\"3f4512b0.dc5bee\",\"kColor\":\"black\",\"vColor\":\"black\",\"template\":\"<html>\\n<head>\\n<style>\\ntable.FixedTable\\n{\\n table-layout: fixed;\\n border: 0;\\n}\\n</style> \\n</head>\\n<body>\\n<table class=\\\"FixedTable\\\">\\n <tbody>\\n <tr ng-repeat=\\\"(k,v) in msg.payload\\\" ng-if=\\\"k != 'Item'\\\">\\n <td style=\\\"width: 250; color:{{msg.kColor}}\\\">{{k}}</td>\\n <td style=\\\"text-align:justify; color:{{msg.vColor}}\\\">{{v}}</td>\\n </tr>\\n </tbody>\\n</table>\\n</body>\\n</html>\",\"color\":\"lime\"};\nreturn msg;","outputs":1,"noerr":0,"x":3060,"y":4390,"wires":[["66a86c89.e1e4ec","7bd08973.eb2448","49798152.e859d8","8031996.9decb68","f57f3a97.88af4"]]},{"id":"b48a1d99.b29fd","type":"inject","z":"b9924a74.4d98f8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":2900,"y":4390,"wires":[["fb40c7a6.d7dad8"]]},{"id":"66a86c89.e1e4ec","type":"debug","z":"b9924a74.4d98f8","name":"A","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3040,"y":4450,"wires":[]},{"id":"7bd08973.eb2448","type":"change","z":"b9924a74.4d98f8","name":"Part 1","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert1","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert1name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3230,"y":4270,"wires":[["ab5f6391.6954e","62d220a6.a4221"]]},{"id":"49798152.e859d8","type":"change","z":"b9924a74.4d98f8","name":"Part 2","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert2","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert2name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3230,"y":4350,"wires":[["18fade6d.1843ca","53a404d1.59f7ac"]]},{"id":"8031996.9decb68","type":"change","z":"b9924a74.4d98f8","name":"Part 3","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert3","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert3name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3230,"y":4440,"wires":[["1ea9bfea.581898","e00dd3af.7301b8"]]},{"id":"f57f3a97.88af4","type":"change","z":"b9924a74.4d98f8","name":"Part 4","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert4","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert4name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3230,"y":4510,"wires":[["4c693616.cd16e8","e9ca2eef.807678"]]},{"id":"ab5f6391.6954e","type":"function","z":"b9924a74.4d98f8","name":"","func":"// Look for message from `switch`\n// and set context.\n\nif (msg.payload == \"true\")\n{\n context.set(\"ONOFF\",\"1\");\n node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n return;\n} else\nif (msg.payload == \"false\")\n{\n context.set(\"ONOFF\",\"0\");\n node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n return;\n}\nvar pass = context.get(\"ONOFF\");\nif (pass == \"0\")\n{\n msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":3560,"y":4270,"wires":[["8bd9edd3.295188","d02fe110.72f05"]]},{"id":"62d220a6.a4221","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"db4d9de.f7f246","order":1,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3360,"y":4220,"wires":[["ab5f6391.6954e","befe2625.a9c3"]]},{"id":"18fade6d.1843ca","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"db4d9de.f7f246","order":2,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3360,"y":4310,"wires":[["53a404d1.59f7ac"]]},{"id":"53a404d1.59f7ac","type":"function","z":"b9924a74.4d98f8","name":"","func":"// Look for message from `switch`\n// and set context.\n\nif (msg.payload == \"true\")\n{\n context.set(\"ONOFF\",\"1\");\n node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n return;\n} else\nif (msg.payload == \"false\")\n{\n context.set(\"ONOFF\",\"0\");\n node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n return;\n}\nvar pass = context.get(\"ONOFF\");\nif (pass == \"0\")\n{\n msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":3560,"y":4350,"wires":[["a09a4ef7.31482","c4c729e8.12af9"]]},{"id":"1ea9bfea.581898","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"db4d9de.f7f246","order":3,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3360,"y":4400,"wires":[["e00dd3af.7301b8"]]},{"id":"e00dd3af.7301b8","type":"function","z":"b9924a74.4d98f8","name":"","func":"// Look for message from `switch`\n// and set context.\n\nif (msg.payload == \"true\")\n{\n context.set(\"ONOFF\",\"1\");\n node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n return;\n} else\nif (msg.payload == \"false\")\n{\n context.set(\"ONOFF\",\"0\");\n node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n return;\n}\nvar pass = context.get(\"ONOFF\");\nif (pass == \"0\")\n{\n msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":3560,"y":4440,"wires":[["e9ba57cb.35bdc","d3502d2e.8ed888"]]},{"id":"4c693616.cd16e8","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"db4d9de.f7f246","order":4,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3360,"y":4480,"wires":[["e9ca2eef.807678"]]},{"id":"e9ca2eef.807678","type":"function","z":"b9924a74.4d98f8","name":"","func":"// Look for message from `switch`\n// and set context.\n\nif (msg.payload == \"true\")\n{\n context.set(\"ONOFF\",\"1\");\n node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n return;\n} else\nif (msg.payload == \"false\")\n{\n context.set(\"ONOFF\",\"0\");\n node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n return;\n}\nvar pass = context.get(\"ONOFF\");\nif (pass == \"0\")\n{\n msg.payload = 0;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":3560,"y":4510,"wires":[["cd17cd34.a3fe7","f313a56e.f0b4d8"]]},{"id":"8bd9edd3.295188","type":"debug","z":"b9924a74.4d98f8","name":"1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3690,"y":4270,"wires":[]},{"id":"d02fe110.72f05","type":"debug","z":"b9924a74.4d98f8","name":"a","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":3690,"y":4300,"wires":[]},{"id":"befe2625.a9c3","type":"debug","z":"b9924a74.4d98f8","name":"From switch","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3580,"y":4220,"wires":[]},{"id":"a09a4ef7.31482","type":"debug","z":"b9924a74.4d98f8","name":"2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3690,"y":4350,"wires":[]},{"id":"c4c729e8.12af9","type":"debug","z":"b9924a74.4d98f8","name":"b","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":3690,"y":4380,"wires":[]},{"id":"e9ba57cb.35bdc","type":"debug","z":"b9924a74.4d98f8","name":"3","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3690,"y":4440,"wires":[]},{"id":"d3502d2e.8ed888","type":"debug","z":"b9924a74.4d98f8","name":"c","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":3690,"y":4470,"wires":[]},{"id":"cd17cd34.a3fe7","type":"debug","z":"b9924a74.4d98f8","name":"4","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3690,"y":4510,"wires":[]},{"id":"f313a56e.f0b4d8","type":"debug","z":"b9924a74.4d98f8","name":"d","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":3690,"y":4540,"wires":[]},{"id":"db4d9de.f7f246","type":"ui_group","name":"Group 3","tab":"260a696.4ccbf96","order":3,"disp":true,"width":6},{"id":"260a696.4ccbf96","type":"ui_tab","z":"","name":"W16-Chart","icon":"dashboard","order":11,"disabled":false,"hidden":false}]