Skip to content

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

Merged
syssi merged 7 commits intorytilahti:masterfrom
syssi:feature/acpartner-toggle-plug
Nov 18, 2018
Merged

AC Partner V3: Add socket support (Closes #337)#415
syssi merged 7 commits intorytilahti:masterfrom
syssi:feature/acpartner-toggle-plug

Conversation

@syssi
Copy link
Copy Markdown
Collaborator

@syssi syssi commented Nov 17, 2018

No description provided.

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

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

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

return self.send("set_power", ["off"])

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

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
Copy Markdown

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'])))
Copy link
Copy Markdown

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)

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)))
Copy link
Copy Markdown

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
Copy Markdown
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!

"""Current operation mode."""
try:
mode = int(self.data[1][3:4])
mode = int(self.data['model_and_state'][1][3:4])
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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