Is there a way to subscribe using the device id instead of the device name?
Like:
subscribe(deviceID, "temperature", eventHandler)
I have an app that creates the subscribe but if the device gets renamed, the device no longer reports subscribed events. Thus, the app user is unaware the subscribe is no longer working as original set.
I was hoping if I could use device id it would prevent this.
Subscription works by (a reference to) the device object, not the name. Renaming will have no effect. If you are seeing this, something else is going on. Sharing a minimal example that demonstrates the problem you see would be helpful to figure it out what that is in your case.
What is TempDevices? Can you share a complete, minimal "working" app that demonstrates the problem? What you have looks like it should work, assuming TempDevices is a standard device input with multiple: true, but seeing a complete app (with just enough to demonstrate) would tell us for sure.
You can also just use it.displayName, which is basically the result of it.label ?: it.name, but that isn't related to your problem -- just looks like your goal with that part.
What I thought after 2 days of working on this it is NOT an issue with subscribe and the way I am using it!!!!
Sorry, and thanks for all of your help. As I read your replies this made me dig deeper into the code and I have discovered the real problem that I can correct.