"lumi.ctrl_ln1.aq1", "lumi.ctrl_ln2.aq1", "lumi.switch.b1nacn02", "lumi.switch.b2nacn02" - consumption
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- embedded-iot
Research direction
Start in the XiaomiCluster parser, where attributes 149, 150 and 152 are mapped to CONSUMPTION, VOLTAGE and POWER for a list of Xiaomi models. Add lumi.ctrl_ln1.aq1 and lumi.ctrl_ln2.aq1 to that list using the same mapping, then check that the Metering cluster's current_summ_delivered is populated in the existing parser tests. Done when both models parse attribute 149 as consumption; the attached custom quirks for the lumi.switch models are a separate concern.
Written by the indexing model from the issue text.
Description
Problem
The "lumi.ctrl_ln1.aq1", "lumi.ctrl_ln2.aq1", "lumi.switch.b1nacn02", "lumi.switch.b2nacn02" devices expose cumulative energy consumption through the Xiaomi proprietary attribute 0xFF01-149.
The XiaomiCluster parser currently maps attributes 149/150/152 to CONSUMPTION/VOLTAGE/POWER only for a specific list of Xiaomi models. The ctrl_ln1.aq1 and ctrl_ln2.aq1 models are missing from that list.
As a result, attribute 149 is parsed as the generic 0xff01-149 attribute and is not forwarded to the standard Metering cluster current_summ_delivered.
Fix
Add lumi.ctrl_ln1.aq1 and lumi.ctrl_ln2.aq1 to the existing model list using the same mapping already used by other Xiaomi power-monitoring devices:
149 → CONSUMPTION
150 → VOLTAGE
152 → POWER
No changes to the CtrlLn device signature, replacement, endpoints, or cluster definitions are required.
Testing
Tested with lumi.ctrl_ln2.aq1.
Before the fix, current_summ_delivered remained 0 even after manually reading the Metering cluster.
After the fix, Home Assistant correctly reports the cumulative energy consumption. The tested device currently reports approximately 232.749 kWh.
Instantaneous power continues to work correctly (approximately 45.7 W in the test).
The fix therefore reuses the existing Xiaomi parsing and scaling logic without introducing device-specific code.
The working custom quirks for lumi.switch.b1nacn02 and lumi.switch.b2nacn02, tested successfully on my devices, are attached to this message.
- Dominant language
- Python
- Stars
- 96
- Forks
- 84
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 30
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zigpy/zha
-
Device override creates the generic entity instead of the vendor-specific one (Light instead of HueLight, ForceOnLight, MinTransitionLight)Possibly taken @zigpy-review-bot claimed this today. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Each time a device becomes available again, ZHA adds another firmware update listener that is never releasedPossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Devices that left the network are re-initialized on every availability check, reading attributes from a device that is gonePossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
entities
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
QuantConnect/lean-cli#792 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35360 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100