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

Add quirk for Sonoff ZBMINIR2 #3428

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open

Conversation

lcheng33775823
Copy link

@lcheng33775823 lcheng33775823 commented Oct 15, 2024

Proposed change

Add quirk for Sonoff ZBMINIR2

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

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.44%. Comparing base (fa734ad) to head (d2483b8).
Report is 29 commits behind head on dev.

Files with missing lines Patch % Lines
zhaquirks/sonoff/zbminir2.py 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3428      +/-   ##
==========================================
+ Coverage   88.71%   89.44%   +0.73%     
==========================================
  Files         306      312       +6     
  Lines        9820    10056     +236     
==========================================
+ Hits         8712     8995     +283     
+ Misses       1108     1061      -47     

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

@lcheng33775823
Copy link
Author

Hi @TheJulianJES, I've created a PR. Is there anything I need to do before merging it?

Copy link
Collaborator

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some suggestions. I'll go ahead and commit some of them to your PR/branch.
I'll still need to check up on some other things.

zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Outdated Show resolved Hide resolved
Comment on lines +33 to +50
async def _read_attributes(
self,
attribute_ids: list[t.uint16_t],
*args,
manufacturer: int | t.uint16_t | None = None,
**kwargs,
):
"""Read attributes ZCL foundation command."""
return await super()._read_attributes(
attribute_ids,
*args,
manufacturer=foundation.ZCLHeader.NO_MANUFACTURER_ID,
**kwargs,
)

@property
def _is_manuf_specific(self):
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, in the future, we should have a better solution for this, so we don't need to duplicate it across all quirks.

Comment on lines +55 to +58
edge_trigger = 0x00
pulse_trigger = 0x01
normally_off_follow_trigger = 0x02
normally_on_follow_trigger = 0x82
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to check which naming convention we want to use here.
Other possibilities include: EdgeTrigger, Edge_Trigger, and Edge_trigger.

zhaquirks/sonoff/zbminir2.py Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Show resolved Hide resolved
zhaquirks/sonoff/zbminir2.py Show resolved Hide resolved
@TheJulianJES TheJulianJES added the needs review This PR should be reviewed soon label Oct 31, 2024
@lcheng33775823
Copy link
Author

Thank you very much for your assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review This PR should be reviewed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants