Skip to content

Add quirk for Aqara Dimmer Switch H2 US (lumi.switch.agl007) - #5284

Open
e11o wants to merge 1 commit into
zigpy:devfrom
e11o:aqara-h2-us-dimmer-agl007
Open

Add quirk for Aqara Dimmer Switch H2 US (lumi.switch.agl007)#5284
e11o wants to merge 1 commit into
zigpy:devfrom
e11o:aqara-h2-us-dimmer-agl007

Conversation

@e11o

@e11o e11o commented Aug 27, 2026

Copy link
Copy Markdown

Proposed change

Adds a quirks-v2 definition for the Aqara Dimmer Switch H2 US (WS-K05E,
lumi.switch.agl007).

Without a quirk the device pairs as a bare on/off switch on endpoint 1: no brightness,
no button events and no access to the Lumi configuration attributes. The merged
switch_agl011.py is the H2 EU dimmer, a rotary with a single control and no button
endpoints, so it does not apply.

The quirk:

  • replaces endpoint 1 with DIMMABLE_LIGHT, so the load becomes a real dimmable light;
  • puts the event-emitting MultistateInputCluster on endpoints 1, 2 and 3
    (1 = paddle, 2 = brightness up, 3 = brightness down);
  • writes the Lumi mode attribute (0x0009 = 1, event mode) on bind, without which the
    buttons never report;
  • exposes an Operation mode select per button (Decoupled / Relay, Lumi attribute
    0x0200, written per endpoint), plus mode switch, dimming phase, power on state,
    min/max brightness and the two LED indicator switches;
  • registers device automation triggers for single/double/hold/release on all three
    buttons.

Values come from zigbee-herdsman-converters' lumi.switch.agl007 definition and
lib/lumi.ts for the attribute ids, and from PRESS_TYPES in
zhaquirks/xiaomi/aqara/opple_remote.py for the press types
({0: hold, 1: single, 2: double, 3: triple, 255: release}), which agrees with Z2M's
lumiAction lookup for this model.

Additional information

Fixes #4983.

Decoupling endpoint 1 (the paddle) disables the up and down buttons entirely, which
is Aqara's own documented behaviour for this device, so in practice only endpoints 2 and
3 are useful to decouple. That is noted in the module docstring so nobody has to
rediscover it.

Two things measured on the unit rather than inherited from the converter:

  • The endpoint map. One press of each button, watched on the event bus with
    endpoints 2 and 3 decoupled: 1_single toggled the load, 2_single and 3_single
    reported without moving it.
  • The dimmer stays reachable over Zigbee when the buttons are decoupled. Level set
    from HA, read back on the device's own power meter: 12.4 W at full, 5.5 W at 178/254,
    1.9 W at 102/254. So DIMMABLE_LIGHT on endpoint 1 is right regardless of how the
    buttons are configured.

One caveat for anyone reading the attribute list: on sw 1.0.6.0 the device accepts
min_brightness (attribute 0x0515) but does not apply it to a Zigbee level
command. With min_brightness = 65 a command for 40% still dimmed the load to 1.9 W.
It appears to bound the local button dimming range only.

Running in production on ZHA since 2026-08-23 (Sonoff dongle, HA Core 2026.8.x,
zha-quirks 2.2.0), where the two decoupled buttons drive a cover through automations on
2_single / 3_single.

Device diagnostics

zha-diagnostics-lumi.switch.agl007.json

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

The H2 US pairs as a bare on/off switch without a quirk: no brightness, no
button events and no access to the Lumi configuration attributes. The merged
switch_agl011.py is the H2 EU rotary and does not apply.

Endpoint 1 becomes a dimmable light, endpoints 1/2/3 get the event-emitting
MultistateInput (paddle, brightness up, brightness down), the Lumi mode
attribute is written on bind so the buttons report, and each button gets its
own operation mode select alongside the dimmer's configuration.

Note that decoupling endpoint 1 disables the up and down buttons entirely, so
only endpoints 2 and 3 are useful to decouple.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.67%. Comparing base (6a3822c) to head (2e300bd).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #5284      +/-   ##
==========================================
+ Coverage   92.60%   92.67%   +0.06%     
==========================================
  Files         424      425       +1     
  Lines       14667    14708      +41     
==========================================
+ Hits        13582    13630      +48     
+ Misses       1085     1078       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Device Support Request] Aqara H2 Dimmer Switch (US)

1 participant