Skip to content

Shelly powerFactor implemented as INT16 instead of INT8Β #30430

@hpuac

Description

@hpuac

What happened?

Hey folks, happy new year!

I changed the reporting interval for some attributes of the Shelly Power Strip 4 Gen4 and Shelly 2PM Gen4
in order to reduce the amount of ZigBee messages sent and received and error whenever trying to change the reporting the interval for haElectricalMeasurement -> powerFactor:

z2m: Request 'zigbee2mqtt/bridge/request/device/reporting/configure' failed with error: 'ZCL command 0x206ef1fffe02edd8/1 haElectricalMeasurement.configReport([{"attribute":"powerFactor","minimumReportInterval":300,"maximumReportInterval":65000,"reportableChange":1}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false}) failed (Status 'INVALID_DATA_TYPE')'

After some digging I finally found why I can't change the reporting interval of the powerFactor for the Shelly devices:
The cluster.ts defines powerFactor as DataType.INT8.
Line 6453: powerFactor: {ID: 0x0510, type: DataType.INT8, min: -100, max: 100, default: 0},
Source: https://github.com/Koenkk/zigbee-herdsman/blob/master/src/zspec/zcl/definition/cluster.ts#L6453

The ID 0x0510 in decimal is: 1296

In the Z2M logs of the Shelly device I can see:
{"attrId":1296,"dataType":41,"attrData":0}

The data type enums are defined as:
INT8 = 0x28 (Decimal 40)
INT16 = 0x29 (Decimal 41)
Source: https://github.com/Koenkk/zigbee-herdsman/blob/master/src/zspec/zcl/definition/enums.ts#L63-L66

So it looks like Shelly implemented the powerFactor as INT16 instead of INT8.

Is this something we can implement a workaround for these Shelly devices?
Or is this something Shelly should fix?

Cheers
Hans

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.7.2

Adapter firmware version

EmberZNet Revision: 8.0.3 [GA]

Adapter

SONOFF ZBDongle-E

Setup

Raspberry Pi 4

Device database.db entry

No response

Debug log

No response

Notes

You're awesome ❀️

Metadata

Metadata

Assignees

No one assigned

    Labels

    problemSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions