From de9f559b50796b4938aec2159f4c320fac0e2987 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 30 Oct 2020 22:44:15 +0100 Subject: [PATCH] Zigbee fix TRADFRI battery percentage --- tasmota/xdrv_23_zigbee_5_converters.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index c0a336c0e..ca6180ed3 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -1238,6 +1238,15 @@ void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) { attr_list.addAttribute(0x0001, 0x0021).setUInt(toPercentageCR2032(mv) * 2); } break; + case 0x00010021: // BatteryPercentage + { + const char * model_c = zigbee_devices.getModelId(_srcaddr); // null if unknown + String modelId((char*) model_c); + if (modelId.startsWith(F("TRADFRI"))) { + attr.setUInt(attr.getUInt() * 2); // bug in TRADFRI battery, need to double the value + } + } + break; case 0x02010008: // Pi Heating Demand - solve Eutotronic bug { const char * manufacturer_c = zigbee_devices.getManufacturerId(_srcaddr); // null if unknown