Hi nimbusgb,
I think that in your case you should leverage the COMMAND subscription mode; indeed it was specifically designed to manage dynamic lists or tables.
Please note that the COMMAND mode requires the management of two mandatory fields, "key" and "command", indicate how progressively modifty the table.
In your case the "key" should be valued withe the MAC address since it serves as an index for the table.
The "command" field should be “ADD”, “UPDATE” or “DELETE”. In your specific case you only need to add a custom field, let's call it "status", with the value "on/off".
Independently if you are reading from the db or receiving a real-time mqtt message, each update will be sent on the same Item, but indicating in the "key" field the MAC address, in the "status" field the actual status of the switch and in the "command" field the value "UPDATE "(or" ADD "if the MAC address is new).
Please also check out this demo with sample source code for both Javascript client and adapter-side managing of the COMMAND mode:
-
https://demos.lightstreamer.com/PortfolioDemo_Basic/
-
https://github.com/Weswit/Lightstreamer-example-Portfolio-client-javascript#basic-portfolio-demo---html-client
Please let us know if you need any further clarifications.
Regards,
Giuseppe