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

Fix Xiaomi H1 alternative signature #2806

Closed

Conversation

dumpfheimer
Copy link
Contributor

Proposed change

It seems like this commit kicked a device signature for Xiaomi H1 switches: 4f5abdd
This PR adds it back.

Additional information

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

@dumpfheimer dumpfheimer changed the title Dumpfheimer/fixing xiaomi h1 face Fix Xiaomi H1 alternative signature Dec 6, 2023
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (aeca76d) 87.35% compared to head (b8d7a49) 87.35%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2806   +/-   ##
=======================================
  Coverage   87.35%   87.35%           
=======================================
  Files         287      287           
  Lines        8835     8837    +2     
=======================================
+ Hits         7718     7720    +2     
  Misses       1117     1117           

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

@TheJulianJES TheJulianJES self-assigned this Dec 9, 2023
@TheJulianJES
Copy link
Collaborator

TheJulianJES commented Dec 9, 2023

Hmm, unless I'm missing something, I don't see where that quirk was removed. Maybe it was using a quirk without MODELS_INFO before and the MODELS_INFO is missing lumi.switch.n2aeu1 now.
Do you still know which (exact) quirk it was using before? (EDIT: Likely XiaomiOpple2ButtonSwitchFace1)

I'll have a look.

Please also attach device diagnostics and/or the device signature. It can be downloaded from the device page.
(Without the quirk applied!)

@TheJulianJES
Copy link
Collaborator

Looks like it matches the XiaomiOpple2ButtonSwitchFace1 signature too:

class XiaomiOpple2ButtonSwitchFace1(XiaomiOpple2ButtonSwitchBase):
"""Xiaomi Opple 2 Button Switch. Face 1."""
signature = {
MODELS_INFO: [(LUMI, "lumi.switch.b2naus01")],

So, (LUMI, "lumi.switch.n2aeu1") just needs to be added to the MODELS_INFO there.
Maybe we should move it to the "H1 double" file too then? Although the lumi.switch.b2naus01 isn't a H1 switch from what I can see.

@TheJulianJES
Copy link
Collaborator

TheJulianJES commented Dec 9, 2023

Okay, it seems like (at least the US models of) Aqara switches sometimes report a different signature when paired. This might explain some things.
In quirks, we need to match all signatures then.

I'll fix #2824 first and then see how many signatures also match the H1 models.

@TheJulianJES
Copy link
Collaborator

TheJulianJES commented Dec 13, 2023

Superseded by #2826
I'll see if we can get that into a patch release of HA.

Thanks for making me aware btw!

@dumpfheimer
Copy link
Contributor Author

Great, thank you!

In addition to this, I made some configuration entities for the H1 and was wondering if there was a better way to match all of the devices using a similar configuration, to prevent a HA PR every time a device is added:
home-assistant/core@a698090

right now the matching works by using a quirk ID, eg

@CONFIG_DIAGNOSTIC_MATCH(
    cluster_handler_names="opple_cluster", quirk_ids="zhaquirks.xiaomi.aqara.opple_switch.XiaomiOpple2ButtonSwitchFace1"
)

Could you point me in the right direction for how I could match these configuration entities to catch all devices?

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.

2 participants