Hi everybody .
I’ve made a project with eight devices (ESP 8266) and i’m using HTTP REST API to read and write values to virtual pins.
In order to access data, i just need the token of each one of the devices which is available.
I also need to read the label of each one of the virtual pins, which is not available via REST.
So i had to get the project JSON object and seek into its information.
Each one widget includes the id of the device it belongs to.
Additionally, there is an array of the devices that belong to the project, device 0, device 1 and so on.
Each one device includes its own id which can be used to find the label of interest.
Device 0 has always id=0, while device 1, device 2 etc have numbers as ids that do not make any sense at a first glance.
So, i was wondering what is the correlation of auth_token of a device with its id in the project.
Finally is there a method to calculate the id of a device from its auth_token
Hi everybody .
I was looking at this recently as well, more out of curiosity that anything else.
I came to the conclusion that something changed in the way that devices are identified at some point in the past year or so.
I have a project that has 6 devices. Four of these devices were added a couple of years ago, and the other two were added more recently.
The original devices have device IDs of 0, 1, 2 & 3
The later devices have device IDs of 44908 & 50243
The last of these devices has a JSON entry called “vendor”, which does not exist in the other devices.
The Interesting thing is that no matter which of the 6 auth codes from the project you use, the JSON that is returned is identical - it’s the description of the parent project that’s being returned.
I was hoping that there may be some undocumented API calls that could give more info on the relationship between the project and the associated devices, but looking through the source code here:
only revealed an api call of server/token/rtc which returns the UNIX time of the RTC widget if its included in a project. Possibly useful in some situation, but not what I was looking for.
I gave up at that point, as I was only doing this out of curiosity.
I guess that i you were running a local server then you could delve into the postgresql database to extract more info on the relationship between projects, devices and widgets.
Hello. There is no correlation between the id and auth token.
Initially we implemented something I call “id locality”. So id of the device for every user was the user specific and was starting from 0. It was working like this
newDevice.id = count(user.device) + 1. Later, we changed this due to some issue we had in the apps to the random id (I don’t remember already what the issue was). However, first device always has id of 0 due to back compatibility issues.
All this is already fixed in the new Blynk app version. And now you can access device by id or by token.
Thank you very much
From what i see, i shall be eager about Blynk2 more than I used to be in the past!
how can i find my device ID on the blynk app?
edit: just figured out that i can add a tag to the device and that becomes the device ID