diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 3a12aff9b..667c5b69c 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -7,6 +7,7 @@ ### 8.1.0.7 20200210 - Add new DHT driver. The old driver can still be used using define USE_DHT_OLD (#7468) +- Fix wrong encoding of Zigbee persistent data ### 8.1.0.6 20200205 diff --git a/tasmota/xdrv_23_zigbee_3_devices.ino b/tasmota/xdrv_23_zigbee_3_devices.ino index 984842380..4814bdb8a 100644 --- a/tasmota/xdrv_23_zigbee_3_devices.ino +++ b/tasmota/xdrv_23_zigbee_3_devices.ino @@ -138,7 +138,7 @@ private: static bool findInVector(const std::vector & vecOfElements, const T & element); template < typename T> - static int32_t findEndpointInVector(const std::vector & vecOfElements, const T & element); + static int32_t findEndpointInVector(const std::vector & vecOfElements, uint8_t element); // find the first endpoint match for a cluster static int32_t findClusterEndpoint(const std::vector & vecOfElements, uint16_t element); @@ -180,12 +180,12 @@ bool Z_Devices::findInVector(const std::vector & vecOfElements, const T & e } template < typename T> -int32_t Z_Devices::findEndpointInVector(const std::vector & vecOfElements, const T & element) { +int32_t Z_Devices::findEndpointInVector(const std::vector & vecOfElements, uint8_t element) { // Find given element in vector int32_t found = 0; for (auto &elem : vecOfElements) { - if ((elem >> 16) & 0xFF == element) { return found; } + if ( ((elem >> 16) & 0xFF) == element) { return found; } found++; } @@ -427,7 +427,7 @@ void Z_Devices::addEndoint(uint16_t shortaddr, uint8_t endpoint) { Z_Device &device = getShortAddr(shortaddr); if (&device == nullptr) { return; } // don't crash if not found _updateLastSeen(device); - if (findEndpointInVector(device.endpoints, ep_profile) < 0) { + if (findEndpointInVector(device.endpoints, endpoint) < 0) { device.endpoints.push_back(ep_profile); dirty(); } @@ -439,7 +439,7 @@ void Z_Devices::addEndointProfile(uint16_t shortaddr, uint8_t endpoint, uint16_t Z_Device &device = getShortAddr(shortaddr); if (&device == nullptr) { return; } // don't crash if not found _updateLastSeen(device); - int32_t found = findEndpointInVector(device.endpoints, ep_profile); + int32_t found = findEndpointInVector(device.endpoints, endpoint); if (found < 0) { device.endpoints.push_back(ep_profile); dirty(); diff --git a/tasmota/xdrv_23_zigbee_4_persistence.ino b/tasmota/xdrv_23_zigbee_4_persistence.ino index fcf1dcdc3..a45ce6709 100644 --- a/tasmota/xdrv_23_zigbee_4_persistence.ino +++ b/tasmota/xdrv_23_zigbee_4_persistence.ino @@ -31,7 +31,7 @@ // // [Array of devices] // [Offset = 2] -// uint8 - length of revice record +// uint8 - length of device record // uint16 - short address // uint64 - long IEEE address // uint8 - number of endpoints @@ -43,6 +43,7 @@ // // str - ModelID (null terminated C string, 32 chars max) // str - Manuf (null terminated C string, 32 chars max) +// str - FriendlyName (null terminated C string, 32 chars max) // reserved for extensions // Memory footprint