Getting ESP Chip ID to MQTT Broker
Posted: Fri Mar 10, 2017 10:39 am
I need to send my ESP serial number to my MQTT broker as the payload. ESP.getChipID returns a 32-bit integer, and MQTT wants a string. After much trial and error I have a solution, but there must be a better way. Here's what I'm doing:
Is there a better way?
Code: Select all
...
char NRValue[8];
String(ESP.getChipId()).toCharArray(NRValue,8);
client.publish("DocTest/ChipID", NRValue);
...
Is there a better way?