From 165e1917ea6999fd6975fb7e6fd13c383c1414c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Tue, 20 Jul 2021 18:57:40 +0200 Subject: [PATCH] Address late review of Ambiclimate, code clean up (#53231) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ambiclimate, code clean up Signed-off-by: Daniel Hjelseth Høyer * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof * Update homeassistant/components/ambiclimate/config_flow.py Co-authored-by: Franck Nijhof * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof * import Signed-off-by: Daniel Hjelseth Høyer Co-authored-by: Franck Nijhof --- homeassistant/components/ambiclimate/climate.py | 13 +++++++------ homeassistant/components/ambiclimate/config_flow.py | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/ambiclimate/climate.py b/homeassistant/components/ambiclimate/climate.py index a49253af6bc..8cfebb1bf69 100644 --- a/homeassistant/components/ambiclimate/climate.py +++ b/homeassistant/components/ambiclimate/climate.py @@ -1,6 +1,7 @@ """Support for Ambiclimate ac.""" import asyncio import logging +from typing import Any import ambiclimate import voluptuous as vol @@ -146,24 +147,24 @@ class AmbiclimateEntity(ClimateEntity): """Initialize the thermostat.""" self._heater = heater self._store = store - self._attr_unique_id = self._heater.device_id - self._attr_name = self._heater.name + self._attr_unique_id = heater.device_id + self._attr_name = heater.name self._attr_device_info = { "identifiers": {(DOMAIN, self.unique_id)}, "name": self.name, "manufacturer": "Ambiclimate", } - self._attr_min_temp = self._heater.get_min_temp() - self._attr_max_temp = self._heater.get_max_temp() + self._attr_min_temp = heater.get_min_temp() + self._attr_max_temp = heater.get_max_temp() - async def async_set_temperature(self, **kwargs) -> None: + async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return await self._heater.set_target_temperature(temperature) - async def async_set_hvac_mode(self, hvac_mode) -> None: + async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set new target hvac mode.""" if hvac_mode == HVAC_MODE_HEAT: await self._heater.turn_on() diff --git a/homeassistant/components/ambiclimate/config_flow.py b/homeassistant/components/ambiclimate/config_flow.py index 7f9ff9e5d09..2643b01185a 100644 --- a/homeassistant/components/ambiclimate/config_flow.py +++ b/homeassistant/components/ambiclimate/config_flow.py @@ -1,6 +1,7 @@ """Config flow for Ambiclimate.""" import logging +from aiohttp import web import ambiclimate from homeassistant import config_entries @@ -139,7 +140,7 @@ class AmbiclimateAuthCallbackView(HomeAssistantView): url = AUTH_CALLBACK_PATH name = AUTH_CALLBACK_NAME - async def get(self, request) -> str: + async def get(self, request: web.Request) -> str: """Receive authorization token.""" code = request.query.get("code") if code is None: