zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Support for Aqara smart wall switch (no neutral, double rocker) - [lumi.switch.l2aeu1]

Open tavalin opened this issue 5 years ago • 38 comments

Information about the device + link

Link to the switch

This device is the new EU version of this US one but has a left and right button instead of top and bottom

What I've done so far:

I copied the device section from the US version (lumi.switch.b2laus01) and changed the model and zigbee model accordingly and I can control the left and right buttons from zigbee2mqtt.

What doesn't work:

  1. The reporting doesn't work i.e. if the switch is manually toggled the state doesn't get updated in zigbee2mqtt.
  2. These switches (like other Aqara wall switches) can be set so that the physical button is disabled and the button can become a virtual switch for something else

Manually trying to configure reporting for endpoint 2 (the right button) through the UI results in the following in the logs:

ERROR: Request 'zigbee2mqtt/bridge/request/device/configure_reporting' failed with error: 'ConfigureReporting 0x54ef4410000d0438/2 genOnOff([{"attribute":"onOff","minimumReportInterval":"1","maximumReportInterval":"10","reportableChange":"1"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'SOFTWARE_FAILURE')'

See section from devices.js below - any help appreciated

    {
        zigbeeModel: ['lumi.switch.l2aeu1'],
        model: 'WS-EUK02',
        vendor: 'Xiaomi',
        description: 'Aqara smart wall switch (no neutral, double rocker)',
  	extend: preset.switch(),
	exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right')],
        meta: {multiEndpoint: true, configureKey: 1},
        endpoint: (device) => {
            return {'left': 1, 'right': 2};
        },
	configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint1 = device.getEndpoint(1);
            await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff']);
            await reporting.onOff(endpoint1);
            const endpoint2 = device.getEndpoint(2);
            await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
            await reporting.onOff(endpoint2);
        },
    }

data/database.db entry of the device

{"id":12,"type":"EndDevice","ieeeAddr":"0x54ef4410000d0438","nwkAddr":21323,"manufId":4447,"manufName":"LUMI","powerSource":"Mains (single phase)","modelId":"lumi.switch.l2aeu1","epList":[1,2,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,2,3,4,5,6,9],"outClusterList":[10,25],"clusters":{"genBasic":{"attributes":{"modelId":"lumi.switch.l2aeu1","manufacturerName":"LUMI","powerSource":1,"zclVersion":3,"appVersion":11,"stackVersion":2,"hwVersion":1,"dateCode":"01-12-2021"}},"genOnOff":{"attributes":{"onOff":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1},{"cluster":2,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":0}],"meta":{}},"2":{"profId":260,"epId":2,"devId":256,"inClusterList":[0,3,4,5,6],"outClusterList":[],"clusters":{"genBasic":{"attributes":{}},"genOnOff":{"attributes":{"onOff":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1},{"cluster":2,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1}],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1},{"cluster":2,"type":"endpoint","deviceIeeeAddress":"0x00124b002160067e","endpointID":1}],"configuredReportings":[],"meta":{}}},"appVersion":11,"stackVersion":2,"hwVersion":1,"dateCode":"01-12-2021","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1},"lastSeen":1614682069845}

tavalin avatar Mar 02 '21 11:03 tavalin

Hi. I'm looking for a way to support similar device but with neutral wire. It is lumi.switch.n2aeu1. Could you explain where did you find and coppied configuration for us version? I'm using Home Assistant with Z2MQTT as addon.

piotrbielaska avatar Mar 02 '21 18:03 piotrbielaska

@piotrbielaska this link explains about adding a new device. The file you need to edit is called devices.js

tavalin avatar Mar 02 '21 19:03 tavalin

@Koenkk are you able to provide any direction please? Is that enough information?

tavalin avatar Mar 04 '21 09:03 tavalin

I had problems using converters and decided to wait until this device will be supported. Description on how to add new device in Home Assistant Add-On is very vague.

piotrbielaska avatar Mar 04 '21 09:03 piotrbielaska

Do you also not get updates of the left switch?

Koenkk avatar Mar 04 '21 16:03 Koenkk

Do you also not get updates of the left switch?

I did get some reports from the left switch but didn't test thoroughly yet. Definitely none from the right.

What does the SOFTWARE_FAILURE mean when I manually tried to set up the bind/report on the right switch?

tavalin avatar Mar 04 '21 19:03 tavalin

I don't know what it exactly means, but this is reported by the device itself (doesn't come from z2m). I suggest sniffing the traffic with the Xiaomi gateway to see how it has to be configured: https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

Koenkk avatar Mar 06 '21 12:03 Koenkk

@Koenkk I've flashed my spare CC2531 as a sniffer and I've got zboss and Wireshark running on Windows 10. I've added the Trust Center key as well as my z2m network key (obtained from Wireshark by re-adding a device) but Wireshark still can't decode/decrypt the payloads.

Am I missing something?

tavalin avatar Mar 06 '21 15:03 tavalin

You need to obtain the Xiaomi gateway key, if you can provide a sniff of the pairing with the Xiaomi gateway I can grab the key from it.

Koenkk avatar Mar 06 '21 15:03 Koenkk

Is there a known channel I should be sniffing for the gateway? Also, is there a way to differentiate traffic to/from z2m and traffic/to from the Aqara gateway?

tavalin avatar Mar 06 '21 19:03 tavalin

The gateway is probably on channel 11, 15, 20 or 25. If Z2M is also on that channel I recommend to turn of all devices on the z2m network.

Koenkk avatar Mar 07 '21 16:03 Koenkk

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Apr 07 '21 00:04 github-actions[bot]

Hi @Koenkk

Can you reopen this and look through this wireshark capture and see if you can help with supporting this device?

Is the sniffer process different for devices using Zigbee 3.0?

PS I am also beta testing a new Aqara Roller Shade cord controller and am having similar issues.

Thanks

l2aeu1.zip

tavalin avatar Jun 04 '21 16:06 tavalin

@tavalin could you provide the network key, this should be revealed when starting the sniffing before pairing the device. And when used with the original gateway, can you click the right button, does the state on the xiaomi gateway update immediately?

Koenkk avatar Jun 04 '21 20:06 Koenkk

I've reported the missing status report to Aqara.

The status on the gateway has a noticeable delay for the right rocker compared to the left one. The assumption is Aqara is polling states.

blakadder avatar Jun 04 '21 20:06 blakadder

@blakadder

The status on the gateway has a noticeable delay for the right rocker compared to the left one. The assumption is Aqara is polling states.

Can you confirm this by taking a sniff? https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

Koenkk avatar Jun 04 '21 20:06 Koenkk

@tavalin could you provide the network key, this should be revealed when starting the sniffing before pairing the device. And when used with the original gateway, can you click the right button, does the state on the xiaomi gateway update immediately?

I am using the new Aqara E1 Hub as I'm testing it also. I no longer have the old Xiaomi hub anymore - i'm not sure if that makes a difference but the new E1 Hub is also Zigbee 3.0.

Sorry if i'm being stupid but can you explain how I can get the network key from the Aqara hub? Is it a just a case of running the sniffer for a while or do I need to do something apart from pairing a device? The how to guide describes pairing a device with z2m to get the network key

Edit: I've added another sniffer log in an attempt to capture more info: l2aeu1-v2.zip

tavalin avatar Jun 04 '21 20:06 tavalin

@tavalin do you have another device to pair? The key can be found in "Transport key" message and should come after the "Association response", I don't know why but maybe because the device has already been paired before.

Koenkk avatar Jun 05 '21 15:06 Koenkk

@blakadder

The status on the gateway has a noticeable delay for the right rocker compared to the left one. The assumption is Aqara is polling states.

Can you confirm this by taking a sniff? https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

Sadly I managed to brick my G2H gateway in the meantime and I don't have any alternatives that support that device

blakadder avatar Jun 06 '21 12:06 blakadder

I've reported the missing status report to Aqara.

The status on the gateway has a noticeable delay for the right rocker compared to the left one. The assumption is Aqara is polling states.

This is consistent with my experience using the Aqara hub. @blakadder how did you raise it with Aqara? Did you get a response yet?

If you don't get a response I have a contact I try.

@Koenkk I will try do more sniffing over the coming weekend with some new devices that haven't been paired before.

tavalin avatar Jun 09 '21 20:06 tavalin