-
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
Closed
Closed
Fix WeMo Emu Issues #10194
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
xdrv_21_wemo_multi.ino - multiple wemo support for Tasmota | ||
|
||
Copyright (C) 2020 Magic73, Heiko Krupp and Theo Arends | ||
Copyright (C) 2020 Magic73, Heiko Krupp, Peter Stevenson and Theo Arends | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -235,8 +235,12 @@ private: | |
|
||
String WemoSerialnumber(void) { | ||
char serial[18]; | ||
|
||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X-%d"), ESP_getChipId(), _deviceId); | ||
if (_deviceId == 1) | ||
{ | ||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X"), ESP_getChipId()); | ||
} else { | ||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X-%d"), ESP_getChipId(), _deviceId); | ||
} | ||
return String(serial); | ||
} | ||
|
||
|
@@ -390,7 +394,14 @@ private: | |
#else | ||
String setup_xml = FPSTR(WEMO_SETUP_XML); | ||
#endif | ||
setup_xml.replace("{x1", SettingsText(SET_FRIENDLYNAME1 + (_deviceId - 1))); | ||
if (_deviceId == 1) | ||
{ | ||
setup_xml.replace("{x1", SettingsText(SET_FRIENDLYNAME1)); | ||
} | ||
else | ||
{ | ||
setup_xml.replace("{x1", SettingsText(SET_FRIENDLYNAME1 + (_deviceId - 1))); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed as in case of a single device This adds to code size. |
||
setup_xml.replace("{x2", WemoUuid()); | ||
setup_xml.replace("{x3", WemoSerialnumber()); | ||
InternalWSSend(200, CT_XML, setup_xml); | ||
|
@@ -459,4 +470,4 @@ bool Xdrv21(uint8_t function) | |
return result; | ||
} | ||
|
||
#endif // USE_WEBSERVER && USE_EMULATION && USE_EMULATION_WEMO | ||
#endif // USE_WEBSERVER && USE_EMULATION && USE_EMULATION_WEMO |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.