From 28920fdeb719704b2cec0e9a63cf236057109d7b Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 20 Sep 2022 14:43:36 +0200 Subject: [PATCH 1/2] Fix bug in Z_attribute::equalsCmd --- tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino index d81cabe5c..1586a8eeb 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino @@ -572,9 +572,9 @@ bool Z_attribute::equalsId(uint16_t _cluster, uint16_t _attr_id, uint8_t suffix) } bool Z_attribute::equalsCmd(uint16_t _cluster, uint8_t _cmd_id, bool _direction, bool cmd_general, uint8_t suffix) const { - if (!key_is_cmd ||key_is_str) { return false; } + if (!key_is_cmd || key_is_str) { return false; } uint16_t _attr_id = _cmd_id | (_direction ? 0x100 : 0x000) | (cmd_general ? 0x200 : 0x000); - if ((this->cluster == _cluster) && (this->attr_id == _attr_id) && (!this->key_is_cmd)) { + if ((this->cluster == _cluster) && (this->attr_id == _attr_id) && (this->key_is_cmd)) { if (suffix) { if (key_suffix == suffix) { return true; } } else { From 44e03f014a2e3f8501e8191cfdbc832cfa0975ce Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 20 Sep 2022 14:45:59 +0200 Subject: [PATCH 2/2] Tests are actually not needed thanks to guarding statement --- tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino index 1586a8eeb..4e67e4673 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_1z_libs.ino @@ -561,7 +561,7 @@ bool Z_attribute::equalsKey(const Z_attribute & attr2, bool ignore_key_suffix) c bool Z_attribute::equalsId(uint16_t _cluster, uint16_t _attr_id, uint8_t suffix) const { if (key_is_cmd || key_is_str) { return false; } - if ((this->cluster == _cluster) && (this->attr_id == _attr_id) && (!this->key_is_cmd)) { + if ((this->cluster == _cluster) && (this->attr_id == _attr_id)) { if (suffix) { if (key_suffix == suffix) { return true; } } else { @@ -574,7 +574,7 @@ bool Z_attribute::equalsId(uint16_t _cluster, uint16_t _attr_id, uint8_t suffix) bool Z_attribute::equalsCmd(uint16_t _cluster, uint8_t _cmd_id, bool _direction, bool cmd_general, uint8_t suffix) const { if (!key_is_cmd || key_is_str) { return false; } uint16_t _attr_id = _cmd_id | (_direction ? 0x100 : 0x000) | (cmd_general ? 0x200 : 0x000); - if ((this->cluster == _cluster) && (this->attr_id == _attr_id) && (this->key_is_cmd)) { + if ((this->cluster == _cluster) && (this->attr_id == _attr_id)) { if (suffix) { if (key_suffix == suffix) { return true; } } else {