Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
880 stars 2.92k forks source link

Failed to configure - UNREPORTABLE-ATTRIBUTE - LeGrand 412171 #7831

Closed glenharris closed 1 week ago

glenharris commented 1 month ago

Hi there,

I have 2x Legrand 412171 (DIN rail mounted contactors - NZ, 230V). Both of them are giving 'Failed to configure' errors, however they seem to be working in Z2M with basic functionality. Z2M is identifying them as: https://www.zigbee2mqtt.io/devices/412171.html#legrand-412171

The error I am receiving is: 2024-08-07 09:40:06Failed to configure 'R19 HTR Studio Guest', attempt 3 (Error: ZCL command 0x000474000084bf94/1 haElectricalMeasurement.configReport([{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":5,"attribute":"activePower"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsCurrent"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsVoltage"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNREPORTABLE_ATTRIBUTE') at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:315:28) at Endpoint.zclCommand (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:770:26) at Endpoint.configureReporting (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:556:9) at setupAttributes (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:76:13) at result.configure (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:1482:29) at Object.configure (/app/node_modules/zigbee-herdsman-converters/src/index.ts:172:21) at Configure.configure (/app/lib/extension/configure.ts:121:13) at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:174:17))

Formatted payload is: [{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":5,"attribute":"activePower"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsCurrent"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsVoltage"}],{"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}

Running Zigbee2MQTT(1.37.1 commit: ea39d86) via a docker container, have about 60 other Zigbee devices that are working fine.

Please let me know any other information you require.

glenharris commented 1 month ago

And forgot to say - thanks for an awesome piece of software!

Koenkk commented 1 month ago

Does the power reporting work?

glenharris commented 1 month ago

Partially. It appears to be reporting valid values for 'power' and 'power_apparent'. 'current' and 'voltage' are constantly shown as zero in the UI.

I have verified that power and power_apparent are changing in response to loads being added/removed. I have not seen non-zero values for current or voltage.

For completeness, here is a representative 'state' output: { "current": 0, "device_mode": "switch", "linkquality": 32, "power": 27, "power_apparent": 29, "power_on_behavior": "previous", "state": "ON", "update": { "installed_version": 5456895, "latest_version": 5916159, "state": "available" }, "voltage": 0, "auto_mode": null, "update_available": null }

Note 1: It is worth noting that I have also seen it report zero for power, when there should have been a small load of a few Watts. I mention this just in case someone sees a zero for power and thinks that value is not being reported. I have seen it report 1W for power, so I know it does report low values (but I haven't checked the actual load, so I dont know how accurate this is). Note 2: I dont know how much precision these types of devices would normally report for current, but we are 230V here and I have had a 1kW power report, so I would have thought if current was being reported I should have seen 4A, so I am assuming a zero value means nothing has been reported by the unit.

Koenkk commented 1 month ago

What value does it return when reading the voltage from the dev console?

Screenshot 2024-08-09 at 14 39 04
glenharris commented 1 month ago

I tried most attributes that seemed plausible, and here is the list of attributes that I could read successfully: image

A definite 'smoking gun' (that may not be related to the original UNREPORTABLE_ATTRIBUTE error above) is that the multiplier and divisor for the current and voltage is set to zero. I HAVE NOT tried modifying those attributes (in case it affects the state for your troubleshooting), but I suspect that if I set those to '1', then the current and voltage would start returning valid values.

Given that I can successfully query the attributes listed in the original error report (activePower, rmsCurrent, rmsVoltage), I wonder if there is some logic in the firmware that barfs (only for reporting) when the divisor/multiplier is zero?

Koenkk commented 1 month ago

but I suspect that if I set those to '1', then the current and voltage would start returning valid values.

It's not something you can set on the device, as you can see the device returns 0 for rmsVoltage, so looks to me the device is broken.

glenharris commented 1 month ago

Yes, I think you are correct. If I attempt to write any of the voltage/divisor attributes (including acPowerMultiplier, which has a non-zero value) I get a READ_ONLY error.

How can I test removing the rmsVoltage and rmsCurrent attributes from the device configuration (assuming that this might be the root cause of the original UNREPORTABLE_ATTRIBUTE error above)?

I am pretty sure I have found the current definition in /node_modules/zigbee-herdsman-converters/devices/legrand.js. Do I have to modify this in-place, or can I override this definition somehow?

(Note that I will be out of contact for a few weeks, so dont expect a quick update).

Thanks again for all your help.

Koenkk commented 4 weeks ago

This should be disabled with the following ext converter: https://gist.github.com/Koenkk/e55c624617f8ecb0af52bb31bec4a929

glenharris commented 1 week ago

That seems to work. In particular, when I re-add the device using that new converter, I get:

[2024-08-29 15:16:16] info:     zh:controller: Interview for '0x000474000084bf99' started
[2024-08-29 15:16:16] info:     z2m: Device '0x000474000084bf99' joined
[2024-08-29 15:16:18] info:     z2m: Starting interview of '0x000474000084bf99'
[2024-08-29 15:16:20] info:     zh:controller: Succesfully interviewed '0x000474000084bf99'
[2024-08-29 15:16:20] info:     z2m: Successfully interviewed '0x000474000084bf99', device has successfully been paired
[2024-08-29 15:16:20] info:     z2m: Device '0x000474000084bf99' is supported, identified as: Legrand DIN contactor module CUSTOM (412171)
[2024-08-29 15:16:22] info:     z2m: Configuring '0x000474000084bf99'
[2024-08-29 15:16:23] info:     z2m: Successfully configured '0x000474000084bf99'

Reporting is then configured with OnOff/onOff and haElectricalMeasurement/activePower. Note that on the 'Exposes' page it is still showing acVoltage and acCurrent as 'null'.

When I revert back to use the original converter, I get:

[2024-09-01 10:04:23] info:     zh:controller: Interview for '0x000474000084bf99' started
[2024-09-01 10:04:23] info:     z2m: Device '0x000474000084bf99' joined
[2024-09-01 10:04:25] info:     z2m: Starting interview of '0x000474000084bf99'
[2024-09-01 10:04:29] info:     zh:controller: Succesfully interviewed '0x000474000084bf99'
[2024-09-01 10:04:29] info:     z2m: Successfully interviewed '0x000474000084bf99', device has successfully been paired
[2024-09-01 10:04:29] info:     z2m: Device '0x000474000084bf99' is supported, identified as: Legrand DIN contactor module (412171)
[2024-09-01 10:04:31] info:     z2m: Configuring '0x000474000084bf99'
[2024-09-01 10:04:33] error:    z2m: Failed to configure '0x000474000084bf99', attempt 1 (Error: ZCL command 0x000474000084bf99/1 haElectricalMeasurement.configReport([{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":5,"attribute":"activePower"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsCurrent"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":null,"attribute":"rmsVoltage"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNREPORTABLE_ATTRIBUTE')
    at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:315:28)
    at Endpoint.zclCommand (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:770:26)
    at Endpoint.configureReporting (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:556:9)
    at setupAttributes (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:76:13)
    at result.configure (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:1482:29)
    at Object.configure (/app/node_modules/zigbee-herdsman-converters/src/index.ts:172:21)
    at Configure.configure (/app/lib/extension/configure.ts:121:13)
    at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:174:17))
(repeated 2 more times)

Reporting shows no elements configured to report. Note that on the 'Exposes' page it shows acVoltage and acCurrent as '0' rather than 'null'.

As far as I can tell, that means success.

Question: Can we update the custom converter to suppress the acVoltage and acCurrent attributes, or will that run the risk of degrading functionality for other devices (that identify using the same model strings)?

Koenkk commented 1 week ago

Note that on the 'Exposes' page it is still showing acVoltage and acCurrent as 'null'.

Could you provide a screenshot of this?

glenharris commented 1 week ago

Sure. When it is first added & configured, the values show up as 'Null V' and 'Null A'. After some time (variable, sometimes seconds, sometimes minutes, maybe reporting interval?), they change to 'N/A V' and 'N/A A'. If I press the 'refresh' button next to either of those elements (say the voltage value) they update as '0 V' and 'Null A' image image image image

Koenkk commented 1 week ago

Found and fixed the issue!

Changes will be available in the dev branch in a few hours from now.

glenharris commented 1 week ago

Thanks for this, much appreciated.

Do any changes need to be committed for the actual device (devices/legrand.ts), or is that custom converter you shared with me a one-off for my specific variant?

Koenkk commented 6 days ago

Do any changes need to be committed for the actual device (devices/legrand.ts)

No, it was fixed somewhere else (the device code was correct). You can remove the external converter, the issue itself will be fixed after the next z2m release.

glenharris commented 6 days ago

I understand. Thanks again.

On Thu, 5 Sept 2024, 11:17 pm Koen Kanters, @.***> wrote:

Do any changes need to be committed for the actual device (devices/legrand.ts)

No, it was fixed somewhere else (the device code was correct). You can remove the external converter, the issue itself will be fixed after the next z2m release.

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee-herdsman-converters/issues/7831#issuecomment-2331259591, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXJK6HUWPH2OZUXVKOIXBTZVA4SVAVCNFSM6AAAAABMDGCJWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZRGI2TSNJZGE . You are receiving this because you authored the thread.Message ID: @.***>