Dear All,
I have a very standard situation where I have multiple temperature/humidity sensors which are distributed in our apartment. I just want to feed the payloads into a ui-table. Important to mention that the sensors do only report when changes in temperature/humidity are registered. And this is what I want to have, just to update the table (and ony the respective cells) if required.
However, my basic problem starts earlier: How can I get both sensors in the example below feed into ui-table ? Please look at my example flow. Is it really required to generate an 'arrayed' payload first ?
[{"id":"5d3de8db.f734e8","type":"inject","z":"2beb2f2e.99868","name":"Output_Sensor_1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"humidity\":42.9,\"temperature\":21.74}","payloadType":"json","x":180,"y":1390,"wires":[["89f58166.2e746"]]},{"id":"65e29898.2f6a28","type":"inject","z":"2beb2f2e.99868","name":"Output_Sensor_2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"humidity\":53.8,\"temperature\":23.41}","payloadType":"json","x":180,"y":1440,"wires":[["47ab2e50.f98bd"]]},{"id":"89f58166.2e746","type":"change","z":"2beb2f2e.99868","name":"","rules":[{"t":"set","p":"payload.room","pt":"msg","to":"Room 1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1390,"wires":[["c622219b.20832"]]},{"id":"47ab2e50.f98bd","type":"change","z":"2beb2f2e.99868","name":"","rules":[{"t":"set","p":"payload.room","pt":"msg","to":"Room 2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1440,"wires":[["c622219b.20832"]]},{"id":"c622219b.20832","type":"function","z":"2beb2f2e.99868","name":"manipulate payload","func":"var t = Math.round(msg.payload.temperature*10)/10; // Temperature\nvar h = Math.round(msg.payload.humidity); // Humidity\nvar r = msg.payload.room; // Room\n\nvar msg1 = { payload: [ { room:r, temp: t, humid: h } ]};\nreturn msg1;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":1410,"wires":[["8bc1cbe9.84e9c8"]]},{"id":"8bc1cbe9.84e9c8","type":"ui_table","z":"2beb2f2e.99868","group":"4b41a1fd.e0159","name":"mytable","order":1,"width":"6","height":"4","columns":[{"field":"room","title":"Room","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"temp","title":"Temperature","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"humid","title":"Humidity","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":880,"y":1410,"wires":[]},{"id":"9107512f.eb64","type":"comment","z":"2beb2f2e.99868","name":"Outputs of Sensor1 and Sensor2 not simultaneous","info":"","x":260,"y":1340,"wires":[]},{"id":"4b41a1fd.e0159","type":"ui_group","name":"Group 5","tab":"29ec6908.552b36","order":5,"disp":true,"width":6},{"id":"29ec6908.552b36","type":"ui_tab","name":"Table_UI_TEST","icon":"track_changes","order":8,"disabled":false,"hidden":false}]
Thanks in advance