From f03158d1432ae8fb9b6eadf7cd5f5a15ea4789ef Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 20 Dec 2020 12:00:40 +0100 Subject: [PATCH] Fix Wemo single device backward compatibility Fix Wemo single device backward compatibility (#10165, #10194) --- tasmota/xdrv_21_wemo_multi.ino | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_21_wemo_multi.ino b/tasmota/xdrv_21_wemo_multi.ino index de8834070..7806b2999 100644 --- a/tasmota/xdrv_21_wemo_multi.ino +++ b/tasmota/xdrv_21_wemo_multi.ino @@ -234,14 +234,18 @@ private: int _deviceId; String WemoSerialnumber(void) { - char serial[18]; + char serial[20]; - snprintf_P(serial, sizeof(serial), PSTR("201612K%08X-%d"), ESP_getChipId(), _deviceId); + char index[8] = { 0 }; + if (_deviceId > 1) { // Keep backward compatibility + snprintf_P(index, sizeof(index), PSTR("%02X"), _deviceId); + } + snprintf_P(serial, sizeof(serial), PSTR("201612K%08X%s"), ESP_getChipId(), index); return String(serial); } String WemoUuid(void) { - char uuid[29]; + char uuid[32]; snprintf_P(uuid, sizeof(uuid), PSTR("Socket-1_0-%s"), WemoSerialnumber().c_str()); return String(uuid);