Dynamic Device List Implementation

Hi all,

I have been trying to find the most effective way to implement a dynamic device list. The goal is to have dynamic list on a dashboard which has all devices with a given tag within it and displays certain fields of each device. Each time one of the visible fields is updated, the list will update with the list of devices and the current value of their fields.

My current implementation is fairly slow; each time the list should update, all data in the list device is deleted, it loops through the account’s device list to find all the devices to add, creates a device for each of these, pulls required fields and adds them to the list. I currently have an implementation where serie will update upon going to the next device, but continues incrementing on further updates. Device 1 and Device 2 could have serie 10 and 11, but after updating they would have 12 and 13.

Speed recap:

  • Deleting data takes time and won’t always remove data from a dynamic table until the page is refreshed
  • Creating an SDK device for every single device every time and accessing required fields is slow
  • I have multiple device lists, each needs to do all of this on every update

The idea I considered is to have a constant serie number for each device as a variable or tag. If Device 1 has data in the device list table with serie 10, when Device 1 updates, pushing the new data with serie 10 again should overwrite the old data without causing duplicates and without the need to wipe the list and access every single device?

Has anyone else attempted to do something similar with lists? If so I’d love to see how you implemented it, I also don’t mind sharing some of my code if it helps others.

Hi Andreas,
Can’t you just use the device ID as a serie for the data? This way it will always update the correct device and will not generate duplicates.

Great point, that’s much more readily accessible and removes a data point!

Do you know how alphabet characters are handled? If I use serie “123ABC”, is the serie equal to the input string, or is this converted to another format like decimal in the back end?

Serials are always string. If you send a decimal or number, it will automatically be converted to a string.