Cloud functions

Get device name

This gives you the device name that is stored in the cloud.


SerialLogHandler logHandler;
bool nameRequested = false;

// Open a serial terminal and see the IP address printed out
void subscriptionHandler(const char *topic, const char *data)
{"topic=%s data=%s", topic, data);

void setup()
    Particle.subscribe("particle/device/name", subscriptionHandler);

void loop() {
    if (Particle.connected() && !nameRequested) {
        nameRequested = true;

Instead of fetching the name from the cloud each time, you can fetch it and store it in retained memory or EEPROM. The DeviceNameHelperRK library makes this easy. The link includes instructions and the library is available in Particle Workbench by using Particle: Install Library or in the Web IDE by searching for DeviceNameHelperRK.