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:
G Johansson 2022-05-01 19:00:58 +02:00 committed by GitHub
parent c842672ed1
commit 2cb9783cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -26,12 +26,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""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]
if not hass.data[DOMAIN]:
del hass.data[DOMAIN]
return True
return False
return unload_ok
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -178,7 +178,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
)
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
return
raise ValueError("No target temperature provided")
if temperature == self.target_temperature:
return
@ -192,7 +192,9 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
temperature = self.device_data.temp_list[0]
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))