From a65f050a438a1d0549b85e9c21f45fab2ba46ead Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 2 Apr 2018 16:34:06 +0200 Subject: [PATCH] Parsing of the model identifier improved --- miio/airconditioningcompanion.py | 37 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/miio/airconditioningcompanion.py b/miio/airconditioningcompanion.py index b20e4f97a..f8a72ef59 100644 --- a/miio/airconditioningcompanion.py +++ b/miio/airconditioningcompanion.py @@ -97,24 +97,28 @@ def air_condition_model(self) -> str: return str(self.data[0]) @property - def hardware_version(self) -> int: - """This is a best guess. Hardware version of the AC Companion. 0: V1, 1: V2, 2: V3""" - return int(self.air_condition_model[16:18]) + def model_format(self) -> str: + """Version number of the model format.""" + return self.air_condition_model[0:2] @property - def air_condition_type(self) -> str: - """This is a best guess.""" - return self.air_condition_model[0:2] + def device_type(self) -> str: + """Device type identifier.""" + return self.air_condition_model[2:4] @property - def air_condition_brand_id(self) -> int: - """Known brand ids: 182, 97, 37, 202, 2782, 197, 192""" - return int(self.air_condition_model[4:8]) + def air_condition_brand(self) -> str: + """ + Brand of the Air Condition. + + Known brand ids (int) are 0182, 0097, 0037, 0202, 02782, 0197, 0192. + """ + return self.air_condition_model[4:8] @property - def air_condition_model_id(self) -> int: + def air_condition_remote(self) -> str: """ - Known model ids: + Known remote ids (int): 80111111, 80111112 (brand: 182) 80222221 (brand: 97) @@ -125,7 +129,16 @@ def air_condition_model_id(self) -> int: 80666661 (brand: 192) """ - return int(self.air_condition_model[8:16]) + return self.air_condition_model[8:16] + + @property + def state_format(self) -> str: + """ + Version number of the state format. + + Known values (int) are: 01, 02, 03 + """ + return self.air_condition_model[16:18] @property def air_condition_configuration(self) -> int: