-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix WeMo Emu Issues #10194
Fix WeMo Emu Issues #10194
Conversation
Pulling latest from upstream
Merge from upstream
Fixes two issues with wemo emulation introduced by the multiple device changes: - Duplicate devices on upgrade (uuid/serial number for device/switch 1 changed) - Device could not be added to routines, Alexa discovery has issue with the UUID/serial number when device id is included
Doesn't your solution also mean that if you removed the wemo emulated device from your setup and then add it again with the new uuid it would solve this issue too? |
Yes correct that would fix the duplicate issue but does not fix the problems with inability to add those devices to routines. There is something about the multi change to the serial number to add the device to the end of it that Alexa doesn’t like. This PR avoids doing that for device 1 effectively reverting the multi behaviour. I would say that device 2+ will still have the same problem with this PR but exactly what serial number change would not break routines is not clear. I lack the devices / time to work that out and this PR is a tactical fix to correct the single device behaviour while still supporting multi WeMo emu. |
else | ||
{ | ||
setup_xml.replace("{x1", SettingsText(SET_FRIENDLYNAME1 + (_deviceId - 1))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed as in case of a single device _deviceId
is 1 resulting in exactly the same Friendlyname as in your fix.
This adds to code size.
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X"), ESP_getChipId()); | ||
} else { | ||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X-%d"), ESP_getChipId(), _deviceId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you change this to
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X%02X"), ESP_getChipId(), _deviceId);
so removing the dash and make it hex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried it. This change works fine for me. The if/else is not necessary in both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you can add the device 1 to routines in Alexa app ok?
Still expect there to be issue with dupe devices after upgrade from pre-9.2.0 as the serial/uuid changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, everithing works fine, now. I had problems adding the devices to a group or routine as not all of them where added to that group. I made several test and when adding a device to that group another device (I expect the one first discovered) was added. Now I can add every new device to every group as I want to. Before I can't add the devices "Terrasse", "Haustuer" and "Garten" to the same group. Now it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx so the latest fix solved both issues.
Closing this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with these two changes to remove the if/else, and yes does fix the routine/group issue, but I do still end up with duplicate device upgrading when the device existed in Alexa before. Both devices still work ok however.
Description:
Wemo emulation issues were found after 9.2.0 upgrade:
Testing showed these issues were due to changes to the UUID/Serial Number presented to Alexa discovery requests, where the device id was appended/included altering the format/content of these identifiers. This fix ensures that for device/switch 1 the original single wemo discovery xml is returned. For switch 2+ the current response will still be returned, so multiple device support is maintained.
Related issue (if applicable): fixes #10165
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass