DPIclimate / broker

3 stars 3 forks source link

Remove device source specific Ubidots label generation #2

Open dajtxx opened 2 years ago

dajtxx commented 2 years ago

When the TTN ubidots function is finally switched off after the broker can handle all traffic, remove the source specific Ubidots label generation code.

We cannot do this as long as the ubifunction is handling any traffic and might create a new Ubidots device, because the broker must be able to arrive at the same device label as the ubifunction so duplicate devices are not created.

After the ubifunction is switched off we can use random UUIDs for device labels.

dajtxx commented 2 years ago

A problem with this idea is that if a crash happens at a wrong time, such as between writing to a new Ubidots device so it gets created and reading it's info back and updating the logical device, a new Ubidots device will be created next time because the logical device does not have the Ubidots label in its properties.

This could be considered a bug in UbidotsWriter - if it writes the logical device back to the database with just the Ubidots label ASAP it would mostly or completely solve this.