Skip to content

Commit

Permalink
Zigbee added for attributes of type uint48 used by energy monitoring (
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger committed Mar 19, 2024
1 parent e644ed0 commit 9c34707
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_5_2_converters.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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:
{
Expand Down
2 changes: 1 addition & 1 deletion tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 9c34707

Please sign in to comment.