From 21c051935f33cb887aff57509114c97d742c6666 Mon Sep 17 00:00:00 2001 From: Nyro Date: Fri, 2 Dec 2022 11:22:35 +0100 Subject: [PATCH] Fix small coding style in recent overkiz code (#82966) * Fix small coding style * Use kwargs[ATTR_TEMPERATURE] in overkiz water_heater * Fix grammar Co-authored-by: Martin Hjelmare --- .../water_heater_entities/domestic_hot_water_production.py | 5 +++-- .../overkiz/water_heater_entities/hitachi_dhw.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/overkiz/water_heater_entities/domestic_hot_water_production.py b/homeassistant/components/overkiz/water_heater_entities/domestic_hot_water_production.py index 49524e19373..5c6ce27942b 100644 --- a/homeassistant/components/overkiz/water_heater_entities/domestic_hot_water_production.py +++ b/homeassistant/components/overkiz/water_heater_entities/domestic_hot_water_production.py @@ -230,7 +230,7 @@ class DomesticHotWaterProduction(OverkizEntity, WaterHeaterEntity): async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" - target_temperature = kwargs.get(ATTR_TEMPERATURE) + target_temperature = kwargs[ATTR_TEMPERATURE] if self.executor.has_command(OverkizCommand.SET_TARGET_TEMPERATURE): await self.executor.async_execute_command( @@ -299,7 +299,8 @@ class DomesticHotWaterProduction(OverkizEntity, WaterHeaterEntity): return if self._is_boost_mode_on: - # We're setting a non Boost mode and the device is currently in Boost mode, the following code remove all boost operations + # We're setting a non Boost mode and the device is currently in Boost mode + # The following code removes all boost operations if self.executor.has_command(OverkizCommand.SET_BOOST_MODE): await self.executor.async_execute_command( OverkizCommand.SET_BOOST_MODE, OverkizCommand.OFF diff --git a/homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py b/homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py index fa8c128e0c1..cd87dded72b 100644 --- a/homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py +++ b/homeassistant/components/overkiz/water_heater_entities/hitachi_dhw.py @@ -1,7 +1,7 @@ """Support for Hitachi DHW.""" from __future__ import annotations -from typing import Any, cast +from typing import Any from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState @@ -63,9 +63,10 @@ class HitachiDHW(OverkizEntity, WaterHeaterEntity): async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" - temperature = cast(float, kwargs.get(ATTR_TEMPERATURE)) + await self.executor.async_execute_command( - OverkizCommand.SET_CONTROL_DHW_SETTING_TEMPERATURE, int(temperature) + OverkizCommand.SET_CONTROL_DHW_SETTING_TEMPERATURE, + int(kwargs[ATTR_TEMPERATURE]), ) @property