But now the handler is not being called anymore! My device is dependent on it’s device name to determine the location it’s in (i.e each photon has a different name defining it’s location, so I can run the same code on multiple devices)
Would you mind sharing the rest of the code, since that might provide some additional insights?
Which mode are you running in? Are you using threading?
A minimal version would be even better, since that will help narrow down potential issues. If that doesn’t work, we can possibly take a look at the code in a PM, to see if there’s something sketchy going on.
One criticla point is when you register the subscription. That should happen no longer than 20sec after cloud connect - best would be immediately in void setup() (as shown in the docs).
I just made the minimal version (full source code below) and it returned my device name! So whatever it is, it’s not related to the particle cloud but in my code somewhere.
Alright I found the issue. Apparently mqtt conflicts with the device name function. I now call mqtt.loop when the device name is set at least once in a global variable. This solved the issue but am not exactly sure how.
I just submitted this as a “support request”:
I need to detect the Photon device name (the one I assigned to it) from inside a script. I copied the code from Particle’s reference docs:
Silly me. I assumed that the use of “spark” was past its sell-by-date so I changed it to “photon”. Didn’t work (returned “null”, no error). But “spark” worked. When are you going to stamp out the old name? What’s it been? 2 years?
It has NOT been taken care of. Did you read my submission all the way through? I have a core, 9 photons & an electron. I remember the spark/particle change.