Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support power/energy for more Aqara (H1) switches, add devices #2784

Merged

Conversation

TheJulianJES
Copy link
Collaborator

@TheJulianJES TheJulianJES commented Nov 29, 2023

Proposed change

This should address multiple issues scattered throughout the repo.

  • power/energy support is added for more Aqara switches
  • the redundant XiaomiMeteringCluster is removed
  • an alternative signature for lumi.switch.n1aeu1 is added
  • MODELS_INFO for lumi.switch.b2naus01, lumi.switch.n2aeu1 (XiaomiOpple2ButtonSwitchFace1, XiaomiOpple2ButtonSwitchFace2) is added
  • comments with clusters IDs are removed in some places

Additional information

The diff is on the bigger side, but looking through the individual commits should make it clear that those "larger changes" are mostly due to refactoring. This PR isn't actually "that big".

Related:

I'm aware that the quirk for lumi.switch.n1aeu1 changes the DEVIEC_TYPE, but this was done for all Aqara switches. The existing quirks and custom quirks seem to do this as well, so it only makes sense to do it here as well.

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

@TheJulianJES TheJulianJES added enhancement Improve an existing quirk new quirk Adds support for a new device labels Nov 29, 2023
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (dev@d30dac2). Click here to learn what that means.

Additional details and impacted files
@@          Coverage Diff           @@
##             dev    #2784   +/-   ##
======================================
  Coverage       ?   87.34%           
======================================
  Files          ?      285           
  Lines          ?     8824           
  Branches       ?        0           
======================================
  Hits           ?     7707           
  Misses         ?     1117           
  Partials       ?        0           

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

@danielshiloah
Copy link

This is amazing progress !! I waited for someone to get the H1 double switch better support in ZHA! thanks.
I do see a problem that the 2 switches identify as switch instead of switch 1 / 2 or L / R.
so you cant base automation on individual buttons.
As well there is no temp property.

@TheJulianJES
Copy link
Collaborator Author

@danielshiloah I didn't expose the device temperature, because it's often inaccurate. I don't have these devices, so I can't check if it's also the case for them.

I do see a problem that the 2 switches identify as switch instead of switch 1 / 2 or L / R.

When using in decoupled mode?

Please create a new issue and tag me (and provide the answer to that question).

@danielshiloah
Copy link

@TheJulianJES opened issue #2907
as requested, thanks!

elupus pushed a commit to elupus/zha-device-handlers that referenced this pull request Jan 17, 2024
…#2784)

* Have `OppleCluster` in `opple_remote.py` inherit `XiaomiAqaraE1Cluster`

* Add `MODELS_INFO` to `XiaomiOpple2ButtonSwitchFace1`, `XiaomiOpple2ButtonSwitchFace2`

These are the only models I found online.

* Add power and energy support for `lumi.switch.n2aeu1`, `lumi.switch.b2naus01`

Seems to be supported

* Add alternative signature for `lumi.switch.n1aeu1`, support power/energy, refactor

* Remove redundant `XiaomiMeteringCluster`

* Use `LUMI` constant for `MODELS_INFO`

* Remove cluster ID comments for opple_switch.py

* Remove redundant device_automation_triggers assignment

* Rename `switch_h1.py` to `switch_h1_single.py`, add comment

* Add `switch_h1_double.py` and move H1 double switch quirk from `opple_switch.py`

* Remove cluster ID comments from `XiaomiOpple2ButtonSwitchFace2`

* Rename `lumi.switch.n2aeu1` quirk to `AqaraH1DoubleRockerSwitchWithNeutral`

* Change imports slightly

* Add support for `lumi.switch.l2aeu1`, `lumi.switch.l2aeu1`

* Improve docstring for opple_switch.py
lgraf pushed a commit to lgraf/zha-device-handlers that referenced this pull request May 6, 2024
…#2784)

* Have `OppleCluster` in `opple_remote.py` inherit `XiaomiAqaraE1Cluster`

* Add `MODELS_INFO` to `XiaomiOpple2ButtonSwitchFace1`, `XiaomiOpple2ButtonSwitchFace2`

These are the only models I found online.

* Add power and energy support for `lumi.switch.n2aeu1`, `lumi.switch.b2naus01`

Seems to be supported

* Add alternative signature for `lumi.switch.n1aeu1`, support power/energy, refactor

* Remove redundant `XiaomiMeteringCluster`

* Use `LUMI` constant for `MODELS_INFO`

* Remove cluster ID comments for opple_switch.py

* Remove redundant device_automation_triggers assignment

* Rename `switch_h1.py` to `switch_h1_single.py`, add comment

* Add `switch_h1_double.py` and move H1 double switch quirk from `opple_switch.py`

* Remove cluster ID comments from `XiaomiOpple2ButtonSwitchFace2`

* Rename `lumi.switch.n2aeu1` quirk to `AqaraH1DoubleRockerSwitchWithNeutral`

* Change imports slightly

* Add support for `lumi.switch.l2aeu1`, `lumi.switch.l2aeu1`

* Improve docstring for opple_switch.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve an existing quirk new quirk Adds support for a new device
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants