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

Do not use deprecated depth property #1124

Merged
merged 2 commits into from
Aug 31, 2021
Merged

Do not use deprecated depth property #1124

merged 2 commits into from
Aug 31, 2021

Conversation

bieniu
Copy link
Contributor

@bieniu bieniu commented Aug 30, 2021

This PR fixes my stupid mistake started here #1089

We don't want to use deprecated depth property to calulate the water_level property.

@@ -199,8 +199,8 @@ def water_level(self) -> Optional[int]:

If water tank is full, depth is 125.
"""
if self.depth is not None and self.depth <= 125:
return int(self.depth / 1.25)
if self.data.get("depth") is not None and self.data["depth"] <= 125:
Copy link
Owner

Choose a reason for hiding this comment

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

Introduce a new local variable depth to avoid typing self.data again:

depth = self.data.get("depth")
...

Otherwise looks ok for me :-)

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.

Thanks! 👍

@rytilahti rytilahti merged commit 9d3fb33 into rytilahti:master Aug 31, 2021
@bieniu bieniu deleted the python-miio/water_level branch August 31, 2021 22:23
rytilahti added a commit that referenced this pull request Sep 1, 2021
* Fix usage of deprecated depth for airhumidifer

[Full Changelog](0.5.7...0.5.8)

**Implemented enhancements:**

- vacuum: skip timezone call if there are no timers [\#1122](#1122) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Smart Mi Standing fan 3 \(Xiaomi Pedestal Fan 3, zhimi.fan.za5\) [\#788](#788)

**Merged pull requests:**

- readme: add micloudfaker to list of related projects [\#1127](#1127) ([unrelentingtech](https://github.com/unrelentingtech))
- Update readme with section for related projects [\#1126](#1126) ([rytilahti](https://github.com/rytilahti))
- add lumi.plug.mmeu01 - ZNCZ04LM [\#1125](#1125) ([starkillerOG](https://github.com/starkillerOG))
- Do not use deprecated `depth` property [\#1124](#1124) ([bieniu](https://github.com/bieniu))
- vacuum: remove long-deprecated 'return\_list' for clean\_details [\#1123](#1123) ([rytilahti](https://github.com/rytilahti))
- deprecate Fan{V2,SA1,ZA1,ZA3,ZA4} in favor of model kwarg [\#1119](#1119) ([rytilahti](https://github.com/rytilahti))
- Add support for Smartmi Standing Fan 3 \(zhimi.fan.za5\) [\#1087](#1087) ([rnovatorov](https://github.com/rnovatorov))
@rytilahti rytilahti mentioned this pull request Sep 1, 2021
rytilahti added a commit that referenced this pull request Sep 1, 2021
* Add support for smart mi standing fan 3 (zhimi.fan.za5)
* Fix usage of deprecated depth for airhumidifer

[Full Changelog](0.5.7...0.5.8)

**Implemented enhancements:**

- vacuum: skip timezone call if there are no timers [\#1122](#1122) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Smart Mi Standing fan 3 \(Xiaomi Pedestal Fan 3, zhimi.fan.za5\) [\#788](#788)

**Merged pull requests:**

- readme: add micloudfaker to list of related projects [\#1127](#1127) ([unrelentingtech](https://github.com/unrelentingtech))
- Update readme with section for related projects [\#1126](#1126) ([rytilahti](https://github.com/rytilahti))
- add lumi.plug.mmeu01 - ZNCZ04LM [\#1125](#1125) ([starkillerOG](https://github.com/starkillerOG))
- Do not use deprecated `depth` property [\#1124](#1124) ([bieniu](https://github.com/bieniu))
- vacuum: remove long-deprecated 'return\_list' for clean\_details [\#1123](#1123) ([rytilahti](https://github.com/rytilahti))
- deprecate Fan{V2,SA1,ZA1,ZA3,ZA4} in favor of model kwarg [\#1119](#1119) ([rytilahti](https://github.com/rytilahti))
- Add support for Smartmi Standing Fan 3 \(zhimi.fan.za5\) [\#1087](#1087) ([rnovatorov](https://github.com/rnovatorov))
rytilahti added a commit that referenced this pull request Sep 1, 2021
* Add support for smart mi standing fan 3 (zhimi.fan.za5)
* Fix usage of deprecated depth for airhumidifer

[Full Changelog](0.5.7...0.5.8)

**Implemented enhancements:**

- vacuum: skip timezone call if there are no timers [\#1122](#1122) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Smart Mi Standing fan 3 \(Xiaomi Pedestal Fan 3, zhimi.fan.za5\) [\#788](#788)

**Merged pull requests:**

- readme: add micloudfaker to list of related projects [\#1127](#1127) ([unrelentingtech](https://github.com/unrelentingtech))
- Update readme with section for related projects [\#1126](#1126) ([rytilahti](https://github.com/rytilahti))
- add lumi.plug.mmeu01 - ZNCZ04LM [\#1125](#1125) ([starkillerOG](https://github.com/starkillerOG))
- Do not use deprecated `depth` property [\#1124](#1124) ([bieniu](https://github.com/bieniu))
- vacuum: remove long-deprecated 'return\_list' for clean\_details [\#1123](#1123) ([rytilahti](https://github.com/rytilahti))
- deprecate Fan{V2,SA1,ZA1,ZA3,ZA4} in favor of model kwarg [\#1119](#1119) ([rytilahti](https://github.com/rytilahti))
- Add support for Smartmi Standing Fan 3 \(zhimi.fan.za5\) [\#1087](#1087) ([rnovatorov](https://github.com/rnovatorov))
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