diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 542aa3a41..edcdb3135 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -1080,6 +1080,11 @@ void ZCLFrame::generateSyntheticAttributes(Z_attribute_list& attr_list) { uint32_t ccccaaaa = (attr.key.id.cluster << 16) | attr.key.id.attr_id; switch (ccccaaaa) { // 0xccccaaaa . c=cluster, a=attribute + case 0x00010020: // BatteryVoltage + if (attr_list.countAttribute(0x0001,0x0021) == 0) { // if it does not already contain BatteryPercentage + uint32_t mv = attr.getUInt()*100; + attr_list.addAttribute(0x0001, 0x0021).setUInt(toPercentageCR2032(mv) * 2); + } case 0x0000FF01: syntheticAqaraSensor(attr_list, attr); break; diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index 788c72e88..c7585134b 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -1774,7 +1774,7 @@ void Z_AutoResponder(uint16_t srcaddr, uint16_t cluster, uint8_t endpoint, const for (uint32_t i=0; i()) { + // value is an array [] const JsonArray& attr_arr = val_attr.as(); attrs_len = attr_arr.size() * attr_item_len; attrs = (uint8_t*) calloc(attrs_len, 1); @@ -569,6 +570,7 @@ void ZbSendRead(const JsonVariant &val_attr, uint16_t device, uint16_t groupaddr i += attr_item_len - 2 - attr_item_offset; // normally 0 } } else if (val_attr.is()) { + // value is an object {} const JsonObject& attr_obj = val_attr.as(); attrs_len = attr_obj.size() * attr_item_len; attrs = (uint8_t*) calloc(attrs_len, 1); @@ -619,10 +621,13 @@ void ZbSendRead(const JsonVariant &val_attr, uint16_t device, uint16_t groupaddr attrs_len = actual_attr_len; } else { - attrs_len = attr_item_len; - attrs = (uint8_t*) calloc(attrs_len, 1); - attrs[0 + attr_item_offset] = val & 0xFF; // little endian - attrs[1 + attr_item_offset] = val >> 8; + // value is a literal + if (0xFFFF != cluster) { + attrs_len = attr_item_len; + attrs = (uint8_t*) calloc(attrs_len, 1); + attrs[0 + attr_item_offset] = val & 0xFF; // little endian + attrs[1 + attr_item_offset] = val >> 8; + } } if (attrs_len > 0) {