Zigbee added for attributes of type `uint48` used by energy monitoring (#20992)

This commit is contained in:
s-hadinger 2024-03-19 22:21:10 +01:00 committed by GitHub
parent e644ed0724
commit 9c34707401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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:
{

View File

@ -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;
}
}