How to make a dynamic Table for MQTT in data

You could use ui-table for your task.

  • you already have your filtered stream of data from device 101 to 109 (?).
  • but there are different timestamps in your data. So you have to define a period in time where you combine the samples. Easiers could be to do Math.floor(msg.timestamp/1000) to combine all messages received in a second. But there are other ways like starting a time for a certain period of time on the first message and collect all messages received during this time. Then you might want to average or min/max the values if more than one messages for the same topic arrives during this time period
  • then or better during the timeframe you have to build your table in the runtime (server) where the "new" timestamp is the row index. your data then should look like this
msg.payload=[
  {
    "id" : timestamp,
    "devices/25/101": 45,
    "devices/25/101": 22,
    "devices/25/101": 38,
    "devices/25/101": 69,
  },
  {
    ... and so on
  }
]
  • and then you can send this to ui-table
  • you can let ui-table do the mapping from your topicto the column name "Temp1" ...

to make the tabe fully dynamic (only sending new values) you might want to send only the new values to the table via commands (there are many post around this here in the forum). But you still have to keep a copy of your table in the runtime as the dashboard is not always connected and the widget visible. Here the ui-table-handler can help. Maybe start here 2D/vertical UI-Table in Tabulator format? - #5 by Christian-Me