Address late review of Ambiclimate, code clean up (#53231)
* Ambiclimate, code clean up Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net> * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof <git@frenck.dev> * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof <git@frenck.dev> * Update homeassistant/components/ambiclimate/config_flow.py Co-authored-by: Franck Nijhof <git@frenck.dev> * Update homeassistant/components/ambiclimate/climate.py Co-authored-by: Franck Nijhof <git@frenck.dev> * import Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net> Co-authored-by: Franck Nijhof <git@frenck.dev>pull/53249/head
parent
1ed7b00b71
commit
165e1917ea
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue