Is there a better way to go from device ID to device object?
Hi,
What is the best, fastest, way to get a reference to a device object when all you have is an ID. The code below below works but I am extremely concerned about the performance when this runs for many thousands of devices.
sensor_ids is an array.
- sensor_ids.forEach( sensor_id => {
- console.log( sensor_id )
- const device_token = await import_sdk6.Utils.getTokenByName( account, sensor_id );
- if ( device_token ) {
- const sensor_dev = await new import_sdk6.Device({ token: device_token });
- if ( sensor_dev ) {
- // Do something
- }
- }
- })
Cheers,
Erwin