From f007777689408c28596da02fe6f64321870b74a6 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Thu, 11 Jan 2024 00:41:49 +0100 Subject: [PATCH] Fix mypy checks --- custom_components/hon/binary_sensor.py | 2 +- custom_components/hon/climate.py | 4 ++-- custom_components/hon/number.py | 4 ++-- custom_components/hon/select.py | 4 ++-- custom_components/hon/sensor.py | 4 ++-- custom_components/hon/switch.py | 5 +++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index d33d689..f304c3f 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -17,7 +17,7 @@ from .hon import HonEntity, unique_entities _LOGGER = logging.getLogger(__name__) -@dataclass +@dataclass(frozen=True) class HonBinarySensorEntityDescription(BinarySensorEntityDescription): on_value: str | float = "" diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index 323cb52..ff44d92 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -31,12 +31,12 @@ from .hon import HonEntity _LOGGER = logging.getLogger(__name__) -@dataclass +@dataclass(frozen=True) class HonACClimateEntityDescription(ClimateEntityDescription): pass -@dataclass +@dataclass(frozen=True) class HonClimateEntityDescription(ClimateEntityDescription): mode: HVACMode = HVACMode.AUTO diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 7c0e504..b9ae6cd 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -19,12 +19,12 @@ from .const import DOMAIN from .hon import HonEntity, unique_entities -@dataclass +@dataclass(frozen=True) class HonConfigNumberEntityDescription(NumberEntityDescription): entity_category: EntityCategory = EntityCategory.CONFIG -@dataclass +@dataclass(frozen=True) class HonNumberEntityDescription(NumberEntityDescription): pass diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index 60bb071..c55e0c5 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -18,12 +18,12 @@ from .hon import HonEntity, unique_entities, get_readable _LOGGER = logging.getLogger(__name__) -@dataclass +@dataclass(frozen=True) class HonSelectEntityDescription(SelectEntityDescription): option_list: dict[int, str] | None = None -@dataclass +@dataclass(frozen=True) class HonConfigSelectEntityDescription(SelectEntityDescription): entity_category: EntityCategory = EntityCategory.CONFIG option_list: dict[int, str] | None = None diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index db88b17..4c8af97 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -34,13 +34,13 @@ from .hon import HonEntity, unique_entities, get_readable _LOGGER = logging.getLogger(__name__) -@dataclass +@dataclass(frozen=True) class HonConfigSensorEntityDescription(SensorEntityDescription): entity_category: EntityCategory = EntityCategory.DIAGNOSTIC option_list: dict[int, str] | None = None -@dataclass +@dataclass(frozen=True) class HonSensorEntityDescription(SensorEntityDescription): option_list: dict[int, str] | None = None diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 8c32ccd..6bc1d2f 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -18,17 +18,18 @@ from .hon import HonEntity, unique_entities _LOGGER = logging.getLogger(__name__) -@dataclass +@dataclass(frozen=True) class HonControlSwitchEntityDescription(SwitchEntityDescription): turn_on_key: str = "" turn_off_key: str = "" +@dataclass(frozen=True) class HonSwitchEntityDescription(SwitchEntityDescription): pass -@dataclass +@dataclass(frozen=True) class HonConfigSwitchEntityDescription(SwitchEntityDescription): entity_category: EntityCategory = EntityCategory.CONFIG