mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Enable strict typing for duotecno (#107261)
This commit is contained in:
parent
de72bbfaad
commit
b2a4de6eed
@ -144,6 +144,7 @@ homeassistant.components.dormakaba_dkey.*
|
|||||||
homeassistant.components.downloader.*
|
homeassistant.components.downloader.*
|
||||||
homeassistant.components.dsmr.*
|
homeassistant.components.dsmr.*
|
||||||
homeassistant.components.dunehd.*
|
homeassistant.components.dunehd.*
|
||||||
|
homeassistant.components.duotecno.*
|
||||||
homeassistant.components.efergy.*
|
homeassistant.components.efergy.*
|
||||||
homeassistant.components.electrasmart.*
|
homeassistant.components.electrasmart.*
|
||||||
homeassistant.components.electric_kiwi.*
|
homeassistant.components.electric_kiwi.*
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""Support for Duotecno binary sensors."""
|
"""Support for Duotecno binary sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from duotecno.controller import PyDuotecno
|
||||||
from duotecno.unit import ControlUnit, VirtualUnit
|
from duotecno.unit import ControlUnit, VirtualUnit
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
@ -17,7 +19,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Duotecno binary sensor on config_entry."""
|
"""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(
|
async_add_entities(
|
||||||
DuotecnoBinarySensor(channel)
|
DuotecnoBinarySensor(channel)
|
||||||
for channel in cntrl.get_units(["ControlUnit", "VirtualUnit"])
|
for channel in cntrl.get_units(["ControlUnit", "VirtualUnit"])
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
"""Support for Duotecno climate devices."""
|
"""Support for Duotecno climate devices."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Final
|
from typing import Any, Final
|
||||||
|
|
||||||
|
from duotecno.controller import PyDuotecno
|
||||||
from duotecno.unit import SensUnit
|
from duotecno.unit import SensUnit
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
@ -33,7 +36,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Duotecno climate based on config_entry."""
|
"""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(
|
async_add_entities(
|
||||||
DuotecnoClimate(channel) for channel in cntrl.get_units(["SensUnit"])
|
DuotecnoClimate(channel) for channel in cntrl.get_units(["SensUnit"])
|
||||||
)
|
)
|
||||||
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from duotecno.controller import PyDuotecno
|
||||||
from duotecno.unit import DuoswitchUnit
|
from duotecno.unit import DuoswitchUnit
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverEntity, CoverEntityFeature
|
from homeassistant.components.cover import CoverEntity, CoverEntityFeature
|
||||||
@ -20,7 +21,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the duoswitch endities."""
|
"""Set up the duoswitch endities."""
|
||||||
cntrl = hass.data[DOMAIN][entry.entry_id]
|
cntrl: PyDuotecno = hass.data[DOMAIN][entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
DuotecnoCover(channel) for channel in cntrl.get_units("DuoswitchUnit")
|
DuotecnoCover(channel) for channel in cntrl.get_units("DuoswitchUnit")
|
||||||
)
|
)
|
||||||
@ -30,13 +31,9 @@ class DuotecnoCover(DuotecnoEntity, CoverEntity):
|
|||||||
"""Representation a Velbus cover."""
|
"""Representation a Velbus cover."""
|
||||||
|
|
||||||
_unit: DuoswitchUnit
|
_unit: DuoswitchUnit
|
||||||
|
_attr_supported_features = (
|
||||||
def __init__(self, unit: DuoswitchUnit) -> None:
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||||
"""Initialize the cover."""
|
)
|
||||||
super().__init__(unit)
|
|
||||||
self._attr_supported_features = (
|
|
||||||
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self) -> bool | None:
|
def is_closed(self) -> bool | None:
|
||||||
|
@ -17,10 +17,9 @@ from .const import DOMAIN
|
|||||||
class DuotecnoEntity(Entity):
|
class DuotecnoEntity(Entity):
|
||||||
"""Representation of a Duotecno entity."""
|
"""Representation of a Duotecno entity."""
|
||||||
|
|
||||||
_attr_should_poll: bool = False
|
_attr_should_poll = False
|
||||||
_unit: BaseUnit
|
|
||||||
|
|
||||||
def __init__(self, unit) -> None:
|
def __init__(self, unit: BaseUnit) -> None:
|
||||||
"""Initialize a Duotecno entity."""
|
"""Initialize a Duotecno entity."""
|
||||||
self._unit = unit
|
self._unit = unit
|
||||||
self._attr_name = unit.get_name()
|
self._attr_name = unit.get_name()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Support for Duotecno lights."""
|
"""Support for Duotecno lights."""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from duotecno.controller import PyDuotecno
|
||||||
from duotecno.unit import DimUnit
|
from duotecno.unit import DimUnit
|
||||||
|
|
||||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||||
@ -18,7 +19,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Duotecno light based on config_entry."""
|
"""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"))
|
async_add_entities(DuotecnoLight(channel) for channel in cntrl.get_units("DimUnit"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Support for Duotecno switches."""
|
"""Support for Duotecno switches."""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from duotecno.controller import PyDuotecno
|
||||||
from duotecno.unit import SwitchUnit
|
from duotecno.unit import SwitchUnit
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
@ -18,7 +19,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Velbus switch based on config_entry."""
|
"""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(
|
async_add_entities(
|
||||||
DuotecnoSwitch(channel) for channel in cntrl.get_units("SwitchUnit")
|
DuotecnoSwitch(channel) for channel in cntrl.get_units("SwitchUnit")
|
||||||
)
|
)
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -1201,6 +1201,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = 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.*]
|
[mypy-homeassistant.components.efergy.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user