Fix min_humidity and max_humidity in homekit_controller (#58507)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
fab93491cc
commit
7d459c03c4
1 changed files with 13 additions and 9 deletions
|
@ -13,11 +13,7 @@ from aiohomekit.model.characteristics import (
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
from aiohomekit.utils import clamp_enum_to_char
|
from aiohomekit.utils import clamp_enum_to_char
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import ClimateEntity
|
||||||
DEFAULT_MAX_HUMIDITY,
|
|
||||||
DEFAULT_MIN_HUMIDITY,
|
|
||||||
ClimateEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
ATTR_HVAC_MODE,
|
ATTR_HVAC_MODE,
|
||||||
ATTR_TARGET_TEMP_HIGH,
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
|
@ -487,14 +483,22 @@ class HomeKitClimateEntity(HomeKitEntity, ClimateEntity):
|
||||||
@property
|
@property
|
||||||
def min_humidity(self):
|
def min_humidity(self):
|
||||||
"""Return the minimum humidity."""
|
"""Return the minimum humidity."""
|
||||||
char = self.service[CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET]
|
min_humidity = self.service[
|
||||||
return char.minValue or DEFAULT_MIN_HUMIDITY
|
CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET
|
||||||
|
].minValue
|
||||||
|
if min_humidity is not None:
|
||||||
|
return min_humidity
|
||||||
|
return super().min_humidity
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_humidity(self):
|
def max_humidity(self):
|
||||||
"""Return the maximum humidity."""
|
"""Return the maximum humidity."""
|
||||||
char = self.service[CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET]
|
max_humidity = self.service[
|
||||||
return char.maxValue or DEFAULT_MAX_HUMIDITY
|
CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET
|
||||||
|
].maxValue
|
||||||
|
if max_humidity is not None:
|
||||||
|
return max_humidity
|
||||||
|
return super().max_humidity
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_action(self):
|
def hvac_action(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue