Multiple devices with same code?

If I try to create multiple devices from the same template, each device gets allocated a different BLYNK_AUTH_TOKEN value. But the devices will be the same and I want to use identical code for the devices. But if each device has a different BLYNK_AUTH_TOKEN I need to have different code for each device, where the only change is the BLYNK_AUTH_TOKEN value. Am I missing something, do I need a separate version of the code for each device ? Surely not !!

Hello @craigm. It is correct, BLYNK_AUTH_TOKEN is different for each device. And for each device you need to have a code with a different BLYNK_AUTH_TOKEN

Regards

If you use Blynk Edgent then you can use identical code for each device, as Auth tokens are allocated dynamically when you provision the device via the app.

Pete.

Thanks, in this case though, I’m using MicroPython as a learning exercise, so that doesn’t work.

In that case you just have to put up with multiple copies of the same code, or do smoothing clever like using different auth tokens based on a hardware identifier like ChipID or MAC Address.

The principal of each device having its own unique identifier (the Auth token) is central to the way that Blynk works. Although previously you could (wrongly) use the same Auth token on multiple devices, the Blynk server now checks for this and will disconnect any device that is currently using the same Auth token.

This check also prevents users fraudulently using more hardware devices than they’ve paid for in their subscription.

Pete.

I should be able to have a unique board configuration file for each board containing the Auth token for that board. Then import that file into the main Micropython code when it starts up, so that I don’t need multiple copies of the same code.