Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.8k stars 1.64k forks source link

Attribute subscription failed but zigbee2mqtt says that device was successfully configured #3256

Closed vke closed 4 years ago

vke commented 4 years ago

Bug Report

What happened

I'm sending mqtt configure command (topic is /zigbee2mqtt/bridge/configure, payload is dimmer_rgbw03)

zigbee2mqtt log:

6|z2m      | zigbee2mqtt:debug 2020-03-31 14:31:04: Received Zigbee message from 'dimmer_rgbw03', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 13 with groupID 0
6|z2m      | zigbee2mqtt:info  2020-03-31 14:31:04: MQTT publish: topic '/zigbee2mqtt/dimmer_rgbw03', payload '{"state_l1":"ON","linkquality":72,"last_seen":1585657864628,"brightness_l1":192,"state_l4":"ON","brightness_l4":16,"state_l2":"ON","brightness_l2":4,"state_l3":"ON","brightness_l3":4}'
6|z2m      | zigbee2mqtt:debug 2020-03-31 14:31:04: Received Zigbee message from 'dimmer_rgbw03', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":128}' from endpoint 13 with groupID 0
6|z2m      | zigbee2mqtt:info  2020-03-31 14:31:04: MQTT publish: topic '/zigbee2mqtt/dimmer_rgbw03', payload '{"state_l1":"ON","linkquality":75,"last_seen":1585657864651,"brightness_l1":192,"state_l4":"ON","brightness_l4":128,"state_l2":"ON","brightness_l2":4,"state_l3":"ON","brightness_l3":4}'
6|z2m      | zigbee2mqtt:info  2020-03-31 14:31:04: Successfully configured 'dimmer_rgbw03'

zigbee2mqtt sends attribute subscription requests for 4 endpoints, each of which supports on/off and level control clusters. But due to an error in the firmware of end device, a subscription is successful only for one (endpoint 13) of the four endpoints, and for the rest endpoints responses come with an "failed" error like this:

ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 12
    Frame Control Field: Data (0x40)
    Destination Endpoint: 1
    Cluster: On/Off (0x0006)
    Profile: Home Automation (0x0104)
    Source Endpoint: 12
    Counter: 160
ZigBee Cluster Library Frame, Command: Configure Reporting Response, Seq: 6
    Frame Control Field: Profile-wide (0x18)
    Sequence Number: 6
    Command: Configure Reporting Response (0x07)
    Attribute Status Record
        Status: Failure (0x01)
        Direction: Reported (0x00)
        Attribute: OnOff (0x0000)

That is, in fact, the subscription was not completed, but there was the message in the log about successful configuration.

Device config:

    {
        zigbeeModel: ['RGBW Dimmer 1.2'],
        model: 'RGBW Dimmer 1.2',
        vendor: 'vke',
        description: 'RGBW Dimmer, 4 separate endpoints',
        supports: 'on/off, brightness',
        fromZigbee: [fz.on_off, fz.brightness],
        toZigbee: [tz.light_onoff_brightness, tz.light_alert, tz.light_brightness_move],
        endpoint: (device) => {
            return {'l1': 10, 'l2': 11, 'l3': 12, 'l4': 13, 'l5': 14};
        },
        meta: {configureKey: 5, multiEndpoint: true},
        configure: async (device, coordinatorEndpoint) => {
            const endpoint10 = device.getEndpoint(10);
            await bind(endpoint10, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
            await configureReporting.onOff(endpoint10);
            await configureReporting.brightness(endpoint10);

            const endpoint11 = device.getEndpoint(11);
            await bind(endpoint11, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
            await configureReporting.onOff(endpoint11);
            await configureReporting.brightness(endpoint11);

            const endpoint12 = device.getEndpoint(12);
            await bind(endpoint12, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
            await configureReporting.onOff(endpoint12);
            await configureReporting.brightness(endpoint12);

            const endpoint13 = device.getEndpoint(13);
            await bind(endpoint13, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
            await configureReporting.onOff(endpoint13);
            await configureReporting.brightness(endpoint13);
        },
    },

What did you expect to happen

Error message at least, I do not know what the correct behavior should be in this case.

How to reproduce it (minimal and precise)

Debug Info

zigbee2mqtt version: 1.12.0-dev (commit #7131c05) CC253X firmware version: cc1352p, {"type":"zStack3x0","meta":{"transportrev":2,"product":1,"majorrel":2,"minorrel":7,"maintrel":1,"revision":20200312}}

Koenkk commented 4 years ago

Fixed in the latest dev branch, when read, write or configureReporting returns a non-zero status code an exception will be thrown causing configure to fail. Thanks!