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 supported angles for dmaker.fan.{p15,p18) #1496

Merged

Conversation

iMicknl
Copy link
Contributor

@iMicknl iMicknl commented Aug 13, 2022

In #1362, supported for P15 and P18 has been added. However, both devices support changing the oscillation angle, but don't have a key present in SUPPORTED_ANGLES.

This PR adds the model keys to SUPPORTED_ANGLES. In a follow-up PR, I am happy to see if we can add full blown support for the P15 to Home Assistant. (since currently it won't be automatically mapped from P15 to P11 and I had to figure this out myself by reading GitHub issues).

  File "/usr/local/lib/python3.10/site-packages/miio/integrations/fan/dmaker/fan_miot.py", line 321, in set_angle
    if angle not in SUPPORTED_ANGLES[self.model]:
KeyError: 'dmaker.fan.p15'

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2022

Codecov Report

Merging #1496 (6bb8bc7) into master (d872d55) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #1496     +/-   ##
=========================================
  Coverage   82.59%   82.59%             
=========================================
  Files         142      142             
  Lines       14009    14009             
  Branches     1583     3341   +1758     
=========================================
  Hits        11571    11571             
  Misses       2219     2219             
  Partials      219      219             
Impacted Files Coverage Δ
miio/integrations/fan/dmaker/fan_miot.py 90.64% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rytilahti
Copy link
Owner

How is the oscillation angle displayed in homeassistant? I'm asking as I'm currently working on to move much of the device-specific information back to this library to avoid making changes to home-assistant integration when adding new models or features. This involves defining what is to be exposed to homeassistant directly inside this code base (see #1495 for a quick overview).

I'll happily merge this PR, as every bit that comes closer to upstream helps. That being said, if you want to contribute further, you could check out that meta issue and see what features available in homeassistant could be defined already inside this lib.

@iMicknl
Copy link
Contributor Author

iMicknl commented Aug 13, 2022

How is the oscillation angle displayed in homeassistant? I'm asking as I'm currently working on to move much of the device-specific information back to this library to avoid making changes to home-assistant integration when adding new models or features. This involves defining what is to be exposed to homeassistant directly inside this code base (see #1495 for a quick overview).

I'll happily merge this PR, as every bit that comes closer to upstream helps. That being said, if you want to contribute further, you could check out that meta issue and see what features available in homeassistant could be defined already inside this lib.

Currently it is exposed as a number entity in Home Assistant. However, when setting a new value the error above will happen since the mapping is not here.

image

I see this as a short-term fix indeed, which is not just Home Assistant related. Everyone that uses a P15 or P18 will benefit from this fix.

Anything I did wrong with the docs, or is CI/CD broken?

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

CI is indeed broken for the docs, this is good to go, thanks! 👍

@rytilahti rytilahti merged commit 8ec26de into rytilahti:master Aug 13, 2022
@iMicknl iMicknl deleted the feature/fix_supported_angle_mapped_fans branch August 13, 2022 20:04
@rytilahti rytilahti changed the title Fix supported angles for mapped fans Fix supported angles for dmaker {p15, p18) Aug 13, 2022
@rytilahti rytilahti changed the title Fix supported angles for dmaker {p15, p18) Fix supported angles for dmaker.fan.{p15, p18) Aug 13, 2022
@rytilahti rytilahti changed the title Fix supported angles for dmaker.fan.{p15, p18) Fix supported angles for dmaker.fan.{p15,p18) Aug 13, 2022
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.

3 participants