From 9c347074016edb217c0815fe63fdedffeb9ba779 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Tue, 19 Mar 2024 22:21:10 +0100 Subject: [PATCH] Zigbee added for attributes of type `uint48` used by energy monitoring (#20992) --- CHANGELOG.md | 2 +- .../tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino | 8 ++++++++ tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5684d8d5..56b9b9537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ## [13.4.0.3] ### Added - +- Zigbee added for attributes of type `uint48` used by energy monitoring ### Breaking Changed 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 de0d1862a..10949ae75 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 @@ -331,6 +331,14 @@ int32_t encodeSingleAttribute(SBuffer &buf, double val_d, const char *val_str, u buf.add32( *((uint32_t*)&f32) ); // cast float as uint32_t break; + case Zuint48: // added for energy value + { + uint64_t u64 = val_d; + buf.add32(u64); + buf.add8(u64 >> 32); + } + break; + case Zstring: case Zstring16: { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino index c0dfc2306..f010d2a2a 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino @@ -459,7 +459,7 @@ void ZbSendReportWrite(class JsonParserToken val_pubwrite, class ZCLFrame & zcl) if (!attr_discrete) { int32_t res = encodeSingleAttribute(buf, val_d, val_str, attr.attr_type); if (res < 0) { - Response_P(PSTR("{\"%s\":\"%s'%s' 0x%02X\"}"), XdrvMailbox.command, PSTR(D_ZIGBEE_UNSUPPORTED_ATTRIBUTE_TYPE " "), key, attr.attr_type); + Response_P(PSTR("{\"%s\":\"%s'%s' 0x%02X\"}"), XdrvMailbox.command, PSTR(D_ZIGBEE_UNSUPPORTED_ATTRIBUTE_TYPE " "), key.getStr(), attr.attr_type); return; } }