Skip to content

Commit

Permalink
Parsing of the model identifier improved
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Apr 2, 2018
1 parent d5fc4c9 commit a65f050
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions miio/airconditioningcompanion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit a65f050

Please sign in to comment.