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

AC Partner V3: Add socket support (Closes #337) #415

Merged
merged 7 commits into from
Nov 18, 2018

Conversation

syssi
Copy link
Collaborator

@syssi syssi commented Nov 17, 2018

No description provided.

return self.send("toggle_plug", ["on"])

@command(
default_output = format_output("Powering socket off"),

Choose a reason for hiding this comment

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

unexpected spaces around keyword / parameter equals

@@ -284,6 +284,20 @@ def off(self):
"""Turn the air condition off by infrared."""
return self.send("set_power", ["off"])

@command(
default_output = format_output("Powering socket on"),

Choose a reason for hiding this comment

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

unexpected spaces around keyword / parameter equals

@coveralls
Copy link

coveralls commented Nov 17, 2018

Coverage Status

Coverage increased (+0.4%) to 73.195% when pulling 06c0c5a on syssi:feature/acpartner-toggle-plug into 293c3a0 on rytilahti:master.

def test_status(self):
self.device._reset_state()

assert repr(self.state()) == repr(AirConditioningCompanionStatus(dict(model_and_state=self.device.start_state, power_socket=self.device.start_device_prop['lumi.0']['plug_state'])))

Choose a reason for hiding this comment

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

line too long (188 > 100 characters)

@@ -126,7 +128,7 @@ def test_off(self):
def test_status(self):
self.device._reset_state()

assert repr(self.state()) == repr(AirConditioningCompanionStatus(self.device.start_state))
assert repr(self.state()) == repr(AirConditioningCompanionStatus(dict(model_and_state=self.device.start_state)))

Choose a reason for hiding this comment

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

line too long (120 > 100 characters)

@syssi syssi requested a review from rytilahti November 18, 2018 18:40
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.

Looks good to me, just a couple of nits. Feel free to merge as you wish!

@@ -208,7 +227,7 @@ def fan_speed(self) -> Optional[FanSpeed]:
def mode(self) -> Optional[OperationMode]:
"""Current operation mode."""
try:
mode = int(self.data[1][3:4])
mode = int(self.data['model_and_state'][1][3:4])
Copy link
Owner

Choose a reason for hiding this comment

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

Considering all of these access the same structure, would it make sense to have a variable for it? Like self.state = self.data['model_and_state'][1]?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point!

if model in MODELS_SUPPORTED:
self.model = model
else:
self.model = MODEL_ACPARTNER_V2
Copy link
Owner

Choose a reason for hiding this comment

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

This defaults to v2 if an unknown model is given? Maybe add a warning logging for that case.

@syssi syssi merged commit 13bad32 into rytilahti:master Nov 18, 2018
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.

4 participants