Skip to content

Commit

Permalink
Set attributes of dataclasses (#1328)
Browse files Browse the repository at this point in the history
* Set attributes of dataclasses

* Add another reason to ping pong mismatch
  • Loading branch information
SukramJ authored Dec 16, 2023
1 parent 59e12cc commit ab81c57
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version 2023.12.3 (2023-12-16)

- Set attributes of dataclasses
- Add another reason to ping pong mismatch

# Version 2023.12.2 (2023-12-15)

- Save all rooms to entity model
Expand Down
3 changes: 2 additions & 1 deletion hahomematic/caches/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ def _fire_event(mismatch_count: int) -> None:
"Pending PONG mismatch: There is a mismatch between send ping events and received pong events for HA instance %s. "
"Possible reason 1: You are running multiple instances of HA with the same instance name configured for this integration. "
"Re-add one instance! Otherwise this HA instance will not receive update events from your CCU. "
"Possible reason 2: Something is stuck on the CCU or hasn't been cleaned up. Therefore, try a CCU restart.",
"Possible reason 2: Something is stuck on the CCU or hasn't been cleaned up. Therefore, try a CCU restart."
"Possible reason 3: Your setup is misconfigured and HA is not able to receive events from the CCU.",
self._interface_id,
)
self._pending_pong_logged = True
Expand Down
8 changes: 4 additions & 4 deletions hahomematic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,14 @@ class ParameterType(StrEnum):
)


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class HubData:
"""Dataclass for hub entities."""

name: str


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class ProgramData(HubData):
"""Dataclass for programs."""

Expand All @@ -501,7 +501,7 @@ class ProgramData(HubData):
last_execute_time: str


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class SystemVariableData(HubData):
"""Dataclass for system variables."""

Expand All @@ -514,7 +514,7 @@ class SystemVariableData(HubData):
values: tuple[str, ...] | None = None


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class SystemInformation:
"""System information of the backend."""

Expand Down
4 changes: 2 additions & 2 deletions hahomematic/platforms/custom/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from hahomematic.platforms.custom.const import Field


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class CustomConfig:
"""Data for custom entity creation."""

Expand All @@ -17,7 +17,7 @@ class CustomConfig:
extended: ExtendedConfig | None = None


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class ExtendedConfig:
"""Extended data for custom entity creation."""

Expand Down
4 changes: 2 additions & 2 deletions hahomematic/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _delete_file(file_name: str) -> None:
_delete_file(file_name=f"{instance_name}_{file_to_delete}")


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class Channel:
"""dataclass for a device channel."""

Expand All @@ -273,7 +273,7 @@ def no(self) -> int | None:
return get_channel_no(self.address)


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class CacheEntry:
"""An entry for the value cache."""

Expand Down
2 changes: 1 addition & 1 deletion hahomematic_support/client_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def _load() -> Any | None:
return await self.central.async_add_executor_job(_load)


@dataclass(slots=True)
@dataclass(frozen=True, kw_only=True, slots=True)
class LocalRessources:
"""Dataclass with information for local client."""

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "hahomematic"
version = "2023.12.2"
version = "2023.12.3"
license = {text = "MIT License"}
description = "Homematic interface for Home Assistant running on Python 3."
readme = "README.md"
Expand Down

0 comments on commit ab81c57

Please sign in to comment.