AC Partner V3: Add socket support (Closes #337)#415
Conversation
miio/airconditioningcompanion.py
Outdated
| return self.send("toggle_plug", ["on"]) | ||
|
|
||
| @command( | ||
| default_output = format_output("Powering socket off"), |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
miio/airconditioningcompanion.py
Outdated
| return self.send("set_power", ["off"]) | ||
|
|
||
| @command( | ||
| default_output = format_output("Powering socket on"), |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
| 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']))) |
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
line too long (120 > 100 characters)
rytilahti
left a comment
There was a problem hiding this comment.
Looks good to me, just a couple of nits. Feel free to merge as you wish!
miio/airconditioningcompanion.py
Outdated
| """Current operation mode.""" | ||
| try: | ||
| mode = int(self.data[1][3:4]) | ||
| mode = int(self.data['model_and_state'][1][3:4]) |
There was a problem hiding this comment.
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]?
| if model in MODELS_SUPPORTED: | ||
| self.model = model | ||
| else: | ||
| self.model = MODEL_ACPARTNER_V2 |
There was a problem hiding this comment.
This defaults to v2 if an unknown model is given? Maybe add a warning logging for that case.
No description provided.