Add quirk for Aqara Dimmer Switch H2 US (lumi.switch.agl007) - #5284
Open
e11o wants to merge 1 commit into
Open
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyis the H2 EU dimmer, a rotary with a single control and no buttonendpoints, so it does not apply.
The quirk:
DIMMABLE_LIGHT, so the load becomes a real dimmable light;MultistateInputClusteron endpoints 1, 2 and 3(1 = paddle, 2 = brightness up, 3 = brightness down);
modeattribute (0x0009 = 1, event mode) on bind, without which thebuttons never report;
Decoupled/Relay, Lumi attribute0x0200, written per endpoint), plus mode switch, dimming phase, power on state,min/max brightness and the two LED indicator switches;
buttons.
Values come from zigbee-herdsman-converters'
lumi.switch.agl007definition andlib/lumi.tsfor the attribute ids, and fromPRESS_TYPESinzhaquirks/xiaomi/aqara/opple_remote.pyfor the press types(
{0: hold, 1: single, 2: double, 3: triple, 255: release}), which agrees with Z2M'slumiActionlookup 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:
endpoints 2 and 3 decoupled:
1_singletoggled the load,2_singleand3_singlereported without moving it.
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_LIGHTon endpoint 1 is right regardless of how thebuttons are configured.
One caveat for anyone reading the attribute list: on sw 1.0.6.0 the device accepts
min_brightness(attribute0x0515) but does not apply it to a Zigbee levelcommand. With
min_brightness = 65a 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
pre-commitchecks pass / the code has been formatted using Black