mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
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>
This commit is contained in:
parent
1ed7b00b71
commit
165e1917ea
@ -1,6 +1,7 @@
|
|||||||
"""Support for Ambiclimate ac."""
|
"""Support for Ambiclimate ac."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import ambiclimate
|
import ambiclimate
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -146,24 +147,24 @@ class AmbiclimateEntity(ClimateEntity):
|
|||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self._heater = heater
|
self._heater = heater
|
||||||
self._store = store
|
self._store = store
|
||||||
self._attr_unique_id = self._heater.device_id
|
self._attr_unique_id = heater.device_id
|
||||||
self._attr_name = self._heater.name
|
self._attr_name = heater.name
|
||||||
self._attr_device_info = {
|
self._attr_device_info = {
|
||||||
"identifiers": {(DOMAIN, self.unique_id)},
|
"identifiers": {(DOMAIN, self.unique_id)},
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
"manufacturer": "Ambiclimate",
|
"manufacturer": "Ambiclimate",
|
||||||
}
|
}
|
||||||
self._attr_min_temp = self._heater.get_min_temp()
|
self._attr_min_temp = heater.get_min_temp()
|
||||||
self._attr_max_temp = self._heater.get_max_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."""
|
"""Set new target temperature."""
|
||||||
temperature = kwargs.get(ATTR_TEMPERATURE)
|
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||||
if temperature is None:
|
if temperature is None:
|
||||||
return
|
return
|
||||||
await self._heater.set_target_temperature(temperature)
|
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."""
|
"""Set new target hvac mode."""
|
||||||
if hvac_mode == HVAC_MODE_HEAT:
|
if hvac_mode == HVAC_MODE_HEAT:
|
||||||
await self._heater.turn_on()
|
await self._heater.turn_on()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Config flow for Ambiclimate."""
|
"""Config flow for Ambiclimate."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from aiohttp import web
|
||||||
import ambiclimate
|
import ambiclimate
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@ -139,7 +140,7 @@ class AmbiclimateAuthCallbackView(HomeAssistantView):
|
|||||||
url = AUTH_CALLBACK_PATH
|
url = AUTH_CALLBACK_PATH
|
||||||
name = AUTH_CALLBACK_NAME
|
name = AUTH_CALLBACK_NAME
|
||||||
|
|
||||||
async def get(self, request) -> str:
|
async def get(self, request: web.Request) -> str:
|
||||||
"""Receive authorization token."""
|
"""Receive authorization token."""
|
||||||
code = request.query.get("code")
|
code = request.query.get("code")
|
||||||
if code is None:
|
if code is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user