diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino index dfb8e962a..4614011aa 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino @@ -173,6 +173,7 @@ public: void parseReportAttributes(Z_attribute_list& attr_list); void generateSyntheticAttributes(Z_attribute_list& attr_list); void removeInvalidAttributes(Z_attribute_list& attr_list); + void applySynonymAttributes(Z_attribute_list& attr_list); void computeSyntheticAttributes(Z_attribute_list& attr_list); void generateCallBacks(Z_attribute_list& attr_list); void parseReadAttributes(uint16_t shortaddr, Z_attribute_list& attr_list); @@ -700,11 +701,11 @@ void ZCLFrame::removeInvalidAttributes(Z_attribute_list& attr_list) { } } + // -// Compute new attributes based on the standard set -// Note: both function are now split to compute on extracted attributes +// Apply synonyms from the plug-in synonym definitions // -void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) { +void ZCLFrame::applySynonymAttributes(Z_attribute_list& attr_list) { Z_Device & device = zigbee_devices.findShortAddr(shortaddr); String modelId((char*) device.modelId); @@ -732,6 +733,20 @@ void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) { attr.setFloat(fval); } } + } +} + +// +// Compute new attributes based on the standard set +// Note: both function are now split to compute on extracted attributes +// +void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) { + Z_Device & device = zigbee_devices.findShortAddr(shortaddr); + + String modelId((char*) device.modelId); + // scan through attributes and apply specific converters + for (auto &attr : attr_list) { + if (attr.key_is_str) { continue; } // pass if key is a name uint32_t ccccaaaa = (attr.cluster << 16) | attr.attr_id; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_8_parsers.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_8_parsers.ino index 3817bdbb5..148f3d47f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_8_parsers.ino @@ -1763,6 +1763,7 @@ void Z_IncomingMessage(class ZCLFrame &zcl_received) { zcl_received.generateSyntheticAttributes(attr_list); zcl_received.removeInvalidAttributes(attr_list); + zcl_received.applySynonymAttributes(attr_list); zcl_received.computeSyntheticAttributes(attr_list); zcl_received.generateCallBacks(attr_list); // set deferred callbacks, ex: Occupancy Z_postProcessAttributes(srcaddr, zcl_received.getSrcEndpoint(), attr_list);