Getting the Device ID (for API)

When adding a device using the API we need the device ID, but all we can get is the Install Code (Hex) or letting the device add automatically to our account and the use the “Screen Info” package that shows the serial number.
How do we show the user the “Device ID” to input to the API?

I’m not entirely sure I understand: When you add a device programmatically through the API, you don’t need a device id. That’s because a device that isn’t yet part of any account doesn’t have one. A device id is only assigned after a device is added. This is also reflected in how the device/create call works: You provide the 8 digit PIN shown on the screen and if that’s correct, the device is bound to your account and only then assigned a device id.

Let me know if that’s helpful of if I misunderstood the question.

The device is added automatic using the custom download option. This way the device is added to my account, but I need at way to control the device via API from my own portal - so I need a way to connect the device with my device on my portal.

The question is: Is the Device_ID the same as the “Serial Number” on the “Info Screen”?

With the connect feature of the custom download, all that happens is that a device is automatically added to the account that created the download, so basically the device/create call happens automatically. Before a device is added it doesn’t have an identity.

Once its added and it has been assigned a setup based on the screen info package, you can match the devices if you compare the serial values from the device/list response with the serial number shown on screen.

Back when that package was built, there was no easy way to know the device id in the code running on the device. This has changed now (thanks to the __metadata info in the generated config.json), so the package could also show the device id directly now. But that’s not implemented.

:wink: Ok - next question: When will it be implemented?

It’s pretty simple actually: Basically in this code that loads the config.json file, just store the value of

device_id = config.__metadata.device_id

and then later render it on the screen. So it’s really 3 lines of code that needs changing. I can create a new branch that implements this tomorrow and you can them import it into your account.

1 Like

It seems that I have misunderstood my developers. I didn’t think of the “initial setup hex number” as a “pin” :slight_smile:

Forget everything…

Eveyone is happy :wink:

Ok. That saves me those 5 minutes adding the feature :slight_smile:

1 Like

The reason for using the “auto add” feature and showing the “Device Info” was that I then could customize the initial screen a little with own logo.
The standard Info-beamer screen shows “” as the initial start screen.
But maybe I should just create my own package :slight_smile:

There is actually a (not yet documented) way to change that addess: Create /config/branding.json with the following content:

    "register-url": ""

Of course if you register the device beforehand and pre-install a package, you can fully decide (and remotely update) how all that looks like. So if that’s an option, it’s a lot more flexible.

1 Like

I have actually made my first package. It was actually quite easy :slight_smile:

So not I just auto register all new displays and uses my own module as default.

1 Like