mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Small cleanup Sensibo (#71149)
* Cleanup * fix temp * Modify set_temp * Apply suggestions from code review Co-authored-by: Shay Levy <levyshay1@gmail.com>
This commit is contained in:
parent
c842672ed1
commit
2cb9783cf5
@ -26,12 +26,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload Sensibo config entry."""
|
"""Unload Sensibo config entry."""
|
||||||
if await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||||
del hass.data[DOMAIN][entry.entry_id]
|
del hass.data[DOMAIN][entry.entry_id]
|
||||||
if not hass.data[DOMAIN]:
|
if not hass.data[DOMAIN]:
|
||||||
del hass.data[DOMAIN]
|
del hass.data[DOMAIN]
|
||||||
return True
|
return unload_ok
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
@ -178,7 +178,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||||
return
|
raise ValueError("No target temperature provided")
|
||||||
|
|
||||||
if temperature == self.target_temperature:
|
if temperature == self.target_temperature:
|
||||||
return
|
return
|
||||||
@ -192,7 +192,9 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||||||
temperature = self.device_data.temp_list[0]
|
temperature = self.device_data.temp_list[0]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return
|
raise ValueError(
|
||||||
|
f"Target temperature has to be one off {str(self.device_data.temp_list)}"
|
||||||
|
)
|
||||||
|
|
||||||
await self._async_set_ac_state_property("targetTemperature", int(temperature))
|
await self._async_set_ac_state_property("targetTemperature", int(temperature))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user