Improved support of the Xiaomi Smart Fan#306
Merged
syssi merged 8 commits intorytilahti:masterfrom Apr 16, 2018
Merged
Conversation
houndci-bot
reviewed
Apr 12, 2018
|
|
||
| _LOGGER = logging.getLogger(__name__) | ||
|
|
||
| class FanException(DeviceException): |
houndci-bot
reviewed
Apr 14, 2018
| assert self.state().battery_state == self.device.start_state["bat_state"] | ||
| assert self.state().button_pressed == self.device.start_state["button_pressed"] | ||
|
|
||
| class DummyFanV3(DummyDevice, Fan): |
| import pytest | ||
|
|
||
| from miio import Fan | ||
| from miio.fan import (MoveDirection, LedBrightness, FanStatus, FanException, |
There was a problem hiding this comment.
'miio.fan.MoveDirection' imported but unused
'miio.fan.FanException' imported but unused
miio/fan.py
Outdated
| return self.data["led"] == "on" | ||
| def led(self) -> Optional[bool]: | ||
| """True if LED is turned on, if available.""" | ||
| if "led" in self.data and self.data["led"] is not None: |
houndci-bot
reviewed
Apr 14, 2018
miio/tests/test_fan.py
Outdated
| self.device.set_rotate(MoveDirection.Left) | ||
| self.device.set_rotate(MoveDirection.Right) | ||
|
|
||
| def test_set_direct_speed(self): |
There was a problem hiding this comment.
redefinition of unused 'test_set_direct_speed' from line 369
miio/tests/test_fan.py
Outdated
| self.device.set_rotate(MoveDirection.Left) | ||
| self.device.set_rotate(MoveDirection.Right) | ||
|
|
||
| def test_set_direct_speed(self): |
There was a problem hiding this comment.
redefinition of unused 'test_set_direct_speed' from line 141
rytilahti
approved these changes
Apr 15, 2018
Owner
rytilahti
left a comment
There was a problem hiding this comment.
Looks great, just a couple of nitpicks :-)
| 'bat_charge', | ||
| 'button_pressed', | ||
| ], | ||
| } |
Owner
There was a problem hiding this comment.
I think it would be nice to have a GENERIC_PROPERTIES (ugh, global variables with uppercasing.. feels so unpythonic :-)), considering quite a few are shared anyway:
>>> set(x) & set(y)
{'bat_charge', 'poweroff_time', 'ac_power', 'led_b', 'use_time', 'humidity',
'button_pressed', 'battery', 'angle_enable', 'speed_level', 'temp_dec',
'child_lock', 'buzzer', 'natural_level', 'power', 'angle', 'speed'}
miio/fan.py
Outdated
| def set_direction(self, direction: MoveDirection): | ||
| """Set move direction.""" | ||
| def set_rotate(self, direction: MoveDirection): | ||
| """Rotate the fan by 5 degrees left/right.""" |
Owner
There was a problem hiding this comment.
left for negative 5, right for positive?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Properties: temp_dec, humidity, angle, speed, ac_power, battery, angle_enable, natural_level, child_lock, buzzer, led_b
Methods: