diff --git a/.strict-typing b/.strict-typing index e67ea8d60d8..6e862159680 100644 --- a/.strict-typing +++ b/.strict-typing @@ -144,6 +144,7 @@ homeassistant.components.dormakaba_dkey.* homeassistant.components.downloader.* homeassistant.components.dsmr.* homeassistant.components.dunehd.* +homeassistant.components.duotecno.* homeassistant.components.efergy.* homeassistant.components.electrasmart.* homeassistant.components.electric_kiwi.* diff --git a/homeassistant/components/duotecno/binary_sensor.py b/homeassistant/components/duotecno/binary_sensor.py index 5867e2d634e..60578adf6a7 100644 --- a/homeassistant/components/duotecno/binary_sensor.py +++ b/homeassistant/components/duotecno/binary_sensor.py @@ -1,5 +1,7 @@ """Support for Duotecno binary sensors.""" +from __future__ import annotations +from duotecno.controller import PyDuotecno from duotecno.unit import ControlUnit, VirtualUnit from homeassistant.components.binary_sensor import BinarySensorEntity @@ -17,7 +19,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up Duotecno binary sensor on config_entry.""" - cntrl = hass.data[DOMAIN][entry.entry_id] + cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id] async_add_entities( DuotecnoBinarySensor(channel) for channel in cntrl.get_units(["ControlUnit", "VirtualUnit"]) diff --git a/homeassistant/components/duotecno/climate.py b/homeassistant/components/duotecno/climate.py index dc10e0a61d9..22be40a812e 100644 --- a/homeassistant/components/duotecno/climate.py +++ b/homeassistant/components/duotecno/climate.py @@ -1,6 +1,9 @@ """Support for Duotecno climate devices.""" +from __future__ import annotations + from typing import Any, Final +from duotecno.controller import PyDuotecno from duotecno.unit import SensUnit from homeassistant.components.climate import ( @@ -33,7 +36,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up Duotecno climate based on config_entry.""" - cntrl = hass.data[DOMAIN][entry.entry_id] + cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id] async_add_entities( DuotecnoClimate(channel) for channel in cntrl.get_units(["SensUnit"]) ) diff --git a/homeassistant/components/duotecno/cover.py b/homeassistant/components/duotecno/cover.py index 0be9daf572b..b8802c77304 100644 --- a/homeassistant/components/duotecno/cover.py +++ b/homeassistant/components/duotecno/cover.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Any +from duotecno.controller import PyDuotecno from duotecno.unit import DuoswitchUnit from homeassistant.components.cover import CoverEntity, CoverEntityFeature @@ -20,7 +21,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up the duoswitch endities.""" - cntrl = hass.data[DOMAIN][entry.entry_id] + cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id] async_add_entities( DuotecnoCover(channel) for channel in cntrl.get_units("DuoswitchUnit") ) @@ -30,13 +31,9 @@ class DuotecnoCover(DuotecnoEntity, CoverEntity): """Representation a Velbus cover.""" _unit: DuoswitchUnit - - def __init__(self, unit: DuoswitchUnit) -> None: - """Initialize the cover.""" - super().__init__(unit) - self._attr_supported_features = ( - CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP - ) + _attr_supported_features = ( + CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP + ) @property def is_closed(self) -> bool | None: diff --git a/homeassistant/components/duotecno/entity.py b/homeassistant/components/duotecno/entity.py index 8d905979bfe..85566b3ebad 100644 --- a/homeassistant/components/duotecno/entity.py +++ b/homeassistant/components/duotecno/entity.py @@ -17,10 +17,9 @@ from .const import DOMAIN class DuotecnoEntity(Entity): """Representation of a Duotecno entity.""" - _attr_should_poll: bool = False - _unit: BaseUnit + _attr_should_poll = False - def __init__(self, unit) -> None: + def __init__(self, unit: BaseUnit) -> None: """Initialize a Duotecno entity.""" self._unit = unit self._attr_name = unit.get_name() diff --git a/homeassistant/components/duotecno/light.py b/homeassistant/components/duotecno/light.py index 9aee4513fca..851dd64bfb2 100644 --- a/homeassistant/components/duotecno/light.py +++ b/homeassistant/components/duotecno/light.py @@ -1,6 +1,7 @@ """Support for Duotecno lights.""" from typing import Any +from duotecno.controller import PyDuotecno from duotecno.unit import DimUnit from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity @@ -18,7 +19,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up Duotecno light based on config_entry.""" - cntrl = hass.data[DOMAIN][entry.entry_id] + cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id] async_add_entities(DuotecnoLight(channel) for channel in cntrl.get_units("DimUnit")) diff --git a/homeassistant/components/duotecno/switch.py b/homeassistant/components/duotecno/switch.py index 63bab750543..d43f82fc657 100644 --- a/homeassistant/components/duotecno/switch.py +++ b/homeassistant/components/duotecno/switch.py @@ -1,6 +1,7 @@ """Support for Duotecno switches.""" from typing import Any +from duotecno.controller import PyDuotecno from duotecno.unit import SwitchUnit from homeassistant.components.switch import SwitchEntity @@ -18,7 +19,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up Velbus switch based on config_entry.""" - cntrl = hass.data[DOMAIN][entry.entry_id] + cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id] async_add_entities( DuotecnoSwitch(channel) for channel in cntrl.get_units("SwitchUnit") ) diff --git a/mypy.ini b/mypy.ini index 97927cf83aa..b84c183cdf1 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1201,6 +1201,16 @@ disallow_untyped_defs = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.duotecno.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.efergy.*] check_untyped_defs = true disallow_incomplete_defs = true