How to generate a GUID, that includes the device ID for an ESP32 on c# Nanoframework

163 Views Asked by At

I am implementing a heatingcontroller on an ESP32, for that I have several classes (TemperatureSensor, Thermostat, ValveController etc.) because there may be more than one of each I want to give each one a unique ID. I would liek to do that using tjhe Guid class, but I want it to include the ESP 32 device ID, so that I have globally unique ID's for each class instance, that can be tied to the hardware device that the class has been instantiated on.

My question is how I can access the device ID in Nanoframework?

So far, I got stuck writing the code because I cannot find a way access the ESP32's ID

2

There are 2 best solutions below

1
Mb175 On

Have u considered using the MacAdress of the device ?

Which nanoFramework device are you using exactly, according to the nanoFramework Docs, there are some devices which support chipID out of the box.

0
José Simões On

To access ESP32 "unique id" which is the MAC address of the device, check this class property NetworkInterface.PhysicalAddress.

Note that the MAC address of an ESP32 can be reprogrammed, unless you protect it by burning the respective fuse.

Using the Guid class will give you a truly unique ID. But that you already know...