mirror of https://github.com/arendst/Tasmota.git
Merge pull request #9297 from s-hadinger/zigbee_sep_13
Zigbee minor fixes
This commit is contained in:
commit
18639730f0
|
@ -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;
|
||||
|
|
|
@ -1774,7 +1774,7 @@ void Z_AutoResponder(uint16_t srcaddr, uint16_t cluster, uint8_t endpoint, const
|
|||
|
||||
for (uint32_t i=0; i<attr_len; i++) {
|
||||
uint16_t attr = attr_list[i];
|
||||
uint32_t ccccaaaa = (cluster << 16) || attr;
|
||||
uint32_t ccccaaaa = (cluster << 16) | attr;
|
||||
|
||||
switch (ccccaaaa) {
|
||||
case 0x00000004: json_out[F("Manufacturer")] = F(USE_ZIGBEE_MANUFACTURER); break; // Manufacturer
|
||||
|
|
|
@ -556,6 +556,7 @@ void ZbSendRead(const JsonVariant &val_attr, uint16_t device, uint16_t groupaddr
|
|||
|
||||
uint16_t val = strToUInt(val_attr);
|
||||
if (val_attr.is<JsonArray>()) {
|
||||
// value is an array []
|
||||
const JsonArray& attr_arr = val_attr.as<const JsonArray&>();
|
||||
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<JsonObject>()) {
|
||||
// value is an object {}
|
||||
const JsonObject& attr_obj = val_attr.as<const JsonObject&>();
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue