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

yeelight: use and expose the color temp range from specs #1247

Merged
merged 7 commits into from
Dec 17, 2021

Conversation

Kirmas
Copy link
Contributor

@Kirmas Kirmas commented Dec 13, 2021

This PR is next stage to integrate spec file. For more information look to #1094

@rytilahti I decided that it would be easier to go function by function and at the end try to add support for background lighting. It's slower, but honestly I don't see any other way to move at least somehow.

Also fix the incorrect parameters while testing on my device.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2021

Codecov Report

Merging #1247 (8977a18) into master (0903990) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1247   +/-   ##
=======================================
  Coverage   79.20%   79.21%           
=======================================
  Files          90       90           
  Lines        9696     9710   +14     
  Branches     1130     1131    +1     
=======================================
+ Hits         7680     7692   +12     
- Misses       1824     1826    +2     
  Partials      192      192           
Impacted Files Coverage Δ
miio/integrations/yeelight/__init__.py 87.22% <100.00%> (-0.56%) ⬇️
miio/integrations/yeelight/tests/test_yeelight.py 96.59% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0903990...8977a18. Read the comment docs.

@Kirmas
Copy link
Contributor Author

Kirmas commented Dec 13, 2021

#1247 (comment) Can anyone tell me why the coverage is less than before? I really do not understand.

@rytilahti rytilahti changed the title set_color_temp function now look to _model_info to get max and min color_temp yeelight: enforce min&max color_temp values in set_color_temp Dec 14, 2021
@rytilahti rytilahti changed the title yeelight: enforce min&max color_temp values in set_color_temp yeelight: enforce min&max color_temp based on specs in set_color_temp Dec 14, 2021
@rytilahti
Copy link
Owner

Perhaps this PR should also include the getter for the valid range? I'm unsure about naming, but maybe something like this?

@property
def valid_temperature_range() -> ColorTempRange:
    passs

- Add self.color_temp range as class property
- Now light type is a part of constructor property. It get chance more easier implement Background light
Co-authored-by: Teemu R. <tpr@iki.fi>
@rytilahti
Copy link
Owner

Thanks @Kirmas 👍

@rytilahti rytilahti changed the title yeelight: enforce min&max color_temp based on specs in set_color_temp yeelight: use and expose the color temp range from specs Dec 14, 2021
@Kirmas
Copy link
Contributor Author

Kirmas commented Dec 17, 2021

Thanks @Kirmas 👍
@rytilahti Are you waiting for something additional from me in this PR? Or isn't time to merge? If second ok. But if first tell me.

@rytilahti
Copy link
Owner

rytilahti commented Dec 17, 2021

Ah, sorry, I got distracted with some other things and forgot to merge it. I think I was about to answer to your question regarding to how to do multiple lights without modifying the yeelight constructor. I'd say the simplest solution would be creating a separate class that handles the light-specific wrappings (e.g., using the prefix for the secondary light while just using the "parent" yeelight for communications).

So in case you just use Yeelight, you would always be controlling the main light. The other lights are exposed for example using a separate properties background_light etc.

@rytilahti rytilahti merged commit df52c19 into rytilahti:master Dec 17, 2021
@Kirmas Kirmas deleted the yeelight_refactoring branch December 18, 2021 16:05
rytilahti added a commit that referenced this pull request Feb 17, 2022
This release adds support for several new devices (see details below, thanks to @PRO-2684, @peleccom, @ymj0424, and @supar), and contains improvements to Roborock S7, yeelight and gateway integrations (thanks to @starkillerOG, @Kirmas,>

Python 3.6 is no longer supported, and Fan{V2,SA1,ZA1,ZA3,ZA4} utility classes are now removed in favor of using Fan class.

[Full Changelog](0.5.9.2...0.5.10)

**Breaking changes:**

- Split fan.py to vendor-specific fan integrations [\#1304](#1304) (@rytilahti)
- Drop python 3.6 support [\#1263](#1263) (@rytilahti)

**Implemented enhancements:**

- Improve miotdevice mappings handling [\#1302](#1302) (@rytilahti)
- airpurifier\_miot: force aqi update prior fetching data [\#1282](#1282) (@rytilahti)
- improve gateway error messages [\#1261](#1261) (@starkillerOG)
- yeelight: use and expose the color temp range from specs [\#1247](#1247) (@Kirmas)
- Add Roborock S7 mop scrub intensity [\#1236](#1236) (@shred86)

**New devices:**

- Add support for zhimi.heater.za2 [\#1301](#1301) (@PRO-2684)
- Dreame F9 Vacuum \(dreame.vacuum.p2008\) support [\#1290](#1290) (@peleccom)
- Add support for Air Purifier 4 Pro \(zhimi.airp.va2\) [\#1287](#1287) (@ymj0424)
- Add support for deerma.humidifier.jsq{s,5} [\#1193](#1193) (@supar)

**Merged pull requests:**

- Add roborock.vacuum.a23 to supported models [\#1314](#1314) (@rytilahti)
- Move philips light implementations to integrations/light/philips [\#1306](#1306) (@rytilahti)
- Move leshow fan implementation to integrations/fan/leshow/ [\#1305](#1305) (@rytilahti)
- Split fan\_miot.py to vendor-specific fan integrations [\#1303](#1303) (@rytilahti)
- Add chuangmi.remote.v2 to chuangmiir [\#1299](#1299) (@rytilahti)
- Perform pypi release on github release [\#1298](#1298) (@rytilahti)
- Print debug recv contents prior accessing its contents [\#1293](#1293) (@rytilahti)
- Add more supported models [\#1292](#1292) (@rytilahti)
- Add more supported models [\#1275](#1275) (@rytilahti)
- Update installation instructions to use poetry [\#1259](#1259) (@rytilahti)
- Add more supported models based on discovery.py's mdns records [\#1258](#1258) (@rytilahti)
@rytilahti rytilahti mentioned this pull request Feb 17, 2022
rytilahti added a commit that referenced this pull request Feb 17, 2022
This release adds support for several new devices (see details below, thanks to @PRO-2684, @peleccom, @ymj0424, and @supar), and contains improvements to Roborock S7, yeelight and gateway integrations (thanks to @starkillerOG, @Kirmas, and @shred86).
Thanks also to everyone who has reported their working model information, we can use this information to provide better discovery in the future and this release silences the warning for known working models.

Python 3.6 is no longer supported, and Fan{V2,SA1,ZA1,ZA3,ZA4} utility classes are now removed in favor of using Fan class.

[Full Changelog](0.5.9.2...0.5.10)

**Breaking changes:**

- Split fan.py to vendor-specific fan integrations [\#1304](#1304) (@rytilahti)
- Drop python 3.6 support [\#1263](#1263) (@rytilahti)

**Implemented enhancements:**

- Improve miotdevice mappings handling [\#1302](#1302) (@rytilahti)
- airpurifier\_miot: force aqi update prior fetching data [\#1282](#1282) (@rytilahti)
- improve gateway error messages [\#1261](#1261) (@starkillerOG)
- yeelight: use and expose the color temp range from specs [\#1247](#1247) (@Kirmas)
- Add Roborock S7 mop scrub intensity [\#1236](#1236) (@shred86)

**New devices:**

- Add support for zhimi.heater.za2 [\#1301](#1301) (@PRO-2684)
- Dreame F9 Vacuum \(dreame.vacuum.p2008\) support [\#1290](#1290) (@peleccom)
- Add support for Air Purifier 4 Pro \(zhimi.airp.va2\) [\#1287](#1287) (@ymj0424)
- Add support for deerma.humidifier.jsq{s,5} [\#1193](#1193) (@supar)

**Merged pull requests:**

- Add roborock.vacuum.a23 to supported models [\#1314](#1314) (@rytilahti)
- Move philips light implementations to integrations/light/philips [\#1306](#1306) (@rytilahti)
- Move leshow fan implementation to integrations/fan/leshow/ [\#1305](#1305) (@rytilahti)
- Split fan\_miot.py to vendor-specific fan integrations [\#1303](#1303) (@rytilahti)
- Add chuangmi.remote.v2 to chuangmiir [\#1299](#1299) (@rytilahti)
- Perform pypi release on github release [\#1298](#1298) (@rytilahti)
- Print debug recv contents prior accessing its contents [\#1293](#1293) (@rytilahti)
- Add more supported models [\#1292](#1292) (@rytilahti)
- Add more supported models [\#1275](#1275) (@rytilahti)
- Update installation instructions to use poetry [\#1259](#1259) (@rytilahti)
- Add more supported models based on discovery.py's mdns records [\#1258](#1258) (@rytilahti)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants