-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setDeviceUniqueId only sets first 12 characters of uniqueId #242
Comments
I wanted to briefly elaborate on my use case in case I'm misunderstanding how the device unique ID is used by Alexa. I have a few personal projects (mostly home automation type things) I'm working on that use fauxmoESP for Alexa integration, and I have a few ESP32 devices in varying states of deployed-ness that I'm using for testing. So there are two cases that I'd like to be able to handle, particularly while I'm still in development/testing (this all becomes less of a problem once a particular project is "permanently" deployed to a particular device):
I was running into some odd behavior with case #1, and that's what led me to find the new I guess it's case #2 that made me concerned about this limitation and open this issue, since even now that I'm setting my own custom unique ID, when I flash the same application on different ESP32 devices each one will use a slightly different actual unique ID because the MAC address part will differ. But to be clear, I'm not currently sure whether this is actually a problem, I haven't been able to test it as thoroughly as I'd like yet. So, it's possible that there isn't really a problem here, but I'm still curious about whether the behavior I've described here is intentional or a bug in |
Yup, definitely a bug. It might be a bit before I can address this (it's not a big deal, just that I am short on time and don't want to cheat on testing etc). After a quick look, it seems to me that we need to set A PR is more than welcome, but if not I'll try to address this soon. Thanks! |
Thanks for confirming Paul! I've got a fix, and a plot twist :-). As for the fix, I'll submit a PR as soon as I submit this comment. As for the plot twist, in testing my bugfix I've found that the format of the unique ID seems to matter, and Alexa won't discover your device if the unique ID isn't in a particular format. I've found some references online to the unique ID mattering (e.g. bwssytems/ha-bridge#1325 and https://www.sigmdel.ca/michel/ha/opi/ha-bridge_03_en.html), but I haven't found anyone that's fully reverse-engineered the required format. From my testing, here are some examples of unique IDs that seem to work:
And here are some that don't work:
And then I stopped at that point since that was good enough to give me a sense of what would and wouldn't work. So anyway, bottom line is that I'm pretty sure my fix works, but this unique ID is definitely tricky and you have to be careful to set it to a value that will work. |
Here's the PR I opened: #243 |
I'm trying to customize my devices' unique IDs using
setDeviceUniqueId
but I'm finding that it only sets the first 12 characters of the unique ID. Can you confirm whether this is expected behavior, or a bug?What I'm doing
Something like this, to set my device's unique ID to a random string:
What I expected
I expected that my device's unique ID would be exactly equal to
ZX5AwfPGNfBt
after callingsetDeviceUniqueId
.What actually happened
According to the verbose logs, my device's uniqueId is actually:
ZX5AwfPGNfBt87:AC:00:00-00
.87:AC
is the last two bytes of this ESP32's MAC address, that whole87:AC:00:00-00
suffix looks like the part of the unique ID that's generated in addDevice. This suffix sticks around because it looks likesetDeviceUniqueId
only overwrites the first 12 characters of the unique ID (here).Is this behavior intentional, or is it a bug leftover from 73ff88e or 2b49757?
The text was updated successfully, but these errors were encountered: