mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix supported features sensibo (#65895)
* Fix features not available * Partial revert * Apply active features * Fix from review
This commit is contained in:
parent
b2f5ab2008
commit
1b27011320
@ -157,7 +157,7 @@ class SensiboClimate(CoordinatorEntity, ClimateEntity):
|
||||
def get_features(self) -> int:
|
||||
"""Get supported features."""
|
||||
features = 0
|
||||
for key in self.coordinator.data[self.unique_id]["features"]:
|
||||
for key in self.coordinator.data[self.unique_id]["full_features"]:
|
||||
if key in FIELD_TO_FLAG:
|
||||
features |= FIELD_TO_FLAG[key]
|
||||
return features
|
||||
@ -240,6 +240,14 @@ class SensiboClimate(CoordinatorEntity, ClimateEntity):
|
||||
|
||||
async def async_set_temperature(self, **kwargs) -> None:
|
||||
"""Set new target temperature."""
|
||||
if (
|
||||
"targetTemperature"
|
||||
not in self.coordinator.data[self.unique_id]["active_features"]
|
||||
):
|
||||
raise HomeAssistantError(
|
||||
"Current mode doesn't support setting Target Temperature"
|
||||
)
|
||||
|
||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||
return
|
||||
|
||||
@ -261,6 +269,9 @@ class SensiboClimate(CoordinatorEntity, ClimateEntity):
|
||||
|
||||
async def async_set_fan_mode(self, fan_mode: str) -> None:
|
||||
"""Set new target fan mode."""
|
||||
if "fanLevel" not in self.coordinator.data[self.unique_id]["active_features"]:
|
||||
raise HomeAssistantError("Current mode doesn't support setting Fanlevel")
|
||||
|
||||
await self._async_set_ac_state_property("fanLevel", fan_mode)
|
||||
|
||||
async def async_set_hvac_mode(self, hvac_mode: str) -> None:
|
||||
@ -277,6 +288,9 @@ class SensiboClimate(CoordinatorEntity, ClimateEntity):
|
||||
|
||||
async def async_set_swing_mode(self, swing_mode: str) -> None:
|
||||
"""Set new target swing operation."""
|
||||
if "swing" not in self.coordinator.data[self.unique_id]["active_features"]:
|
||||
raise HomeAssistantError("Current mode doesn't support setting Swing")
|
||||
|
||||
await self._async_set_ac_state_property("swing", swing_mode)
|
||||
|
||||
async def async_turn_on(self) -> None:
|
||||
|
@ -72,7 +72,17 @@ class SensiboDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
)
|
||||
if temperatures_list:
|
||||
temperature_step = temperatures_list[1] - temperatures_list[0]
|
||||
features = list(ac_states)
|
||||
|
||||
active_features = list(ac_states)
|
||||
full_features = set()
|
||||
for mode in capabilities["modes"]:
|
||||
if "temperatures" in capabilities["modes"][mode]:
|
||||
full_features.add("targetTemperature")
|
||||
if "swing" in capabilities["modes"][mode]:
|
||||
full_features.add("swing")
|
||||
if "fanLevels" in capabilities["modes"][mode]:
|
||||
full_features.add("fanLevel")
|
||||
|
||||
state = hvac_mode if hvac_mode else "off"
|
||||
|
||||
fw_ver = dev["firmwareVersion"]
|
||||
@ -100,7 +110,8 @@ class SensiboDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"temp_unit": temperature_unit_key,
|
||||
"temp_list": temperatures_list,
|
||||
"temp_step": temperature_step,
|
||||
"features": features,
|
||||
"active_features": active_features,
|
||||
"full_features": full_features,
|
||||
"state": state,
|
||||
"fw_ver": fw_ver,
|
||||
"fw_type": fw_type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user