feat: support more devices.

This commit is contained in:
sususweet
2025-09-25 10:50:39 +08:00
parent f99019bdca
commit 40ba24c32a
9 changed files with 774 additions and 10 deletions

View File

@@ -100,7 +100,13 @@ class MideaClimateEntity(MideaEntity, ClimateEntity):
@property
def current_temperature(self):
return self.device_attributes.get(self._key_current_temperature)
temp = self.device_attributes.get(self._key_current_temperature)
if temp is not None:
try:
return float(temp)
except (ValueError, TypeError):
return None
return None
@property
def target_temperature(self):
@@ -108,10 +114,19 @@ class MideaClimateEntity(MideaEntity, ClimateEntity):
temp_int = self.device_attributes.get(self._key_target_temperature[0])
tem_dec = self.device_attributes.get(self._key_target_temperature[1])
if temp_int is not None and tem_dec is not None:
return temp_int + tem_dec
try:
return float(temp_int) + float(tem_dec)
except (ValueError, TypeError):
return None
return None
else:
return self.device_attributes.get(self._key_target_temperature)
temp = self.device_attributes.get(self._key_target_temperature)
if temp is not None:
try:
return float(temp)
except (ValueError, TypeError):
return None
return None
@property
def min_temp(self):