Skip to content

Commit

Permalink
Cleanup data point (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ authored Nov 19, 2024
1 parent d296bb0 commit d91d83a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 2024.11.6 (2024-11-19)

- Cleanup data point

# Version 2024.11.5 (2024-11-19)

- Fix returned version of client
Expand Down
2 changes: 1 addition & 1 deletion hahomematic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
from typing import Any, Final, Required, TypedDict

VERSION: Final = "2024.11.5"
VERSION: Final = "2024.11.6"

DEFAULT_CONNECTION_CHECKER_INTERVAL: Final = 15 # check if connection is available via rpc ping
DEFAULT_CUSTOM_ID: Final = "custom_id"
Expand Down
20 changes: 5 additions & 15 deletions hahomematic/model/data_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def central(self) -> hmcu.CentralUnit:
def full_name(self) -> str:
"""Return the full name of the data_point."""

@property
def is_valid(self) -> bool:
"""Return, if the value of the data_point is valid based on the refreshed at datetime."""
return self._refreshed_at > INIT_DATETIME

@state_property
def modified_at(self) -> datetime:
"""Return the last update datetime value."""
Expand Down Expand Up @@ -542,26 +547,11 @@ def is_readable(self) -> bool:
"""Return, if data_point is readable."""
return bool(self._operations & Operations.READ)

@property
def is_valid(self) -> bool:
"""Return, if the value of the data_point is valid based on the refreshed at datetime."""
return self._refreshed_at > INIT_DATETIME

@property
def is_writeable(self) -> bool:
"""Return, if data_point is writeable."""
return False if self._is_forced_sensor else bool(self._operations & Operations.WRITE)

@state_property
def modified_at(self) -> datetime:
"""Return the last modified datetime value."""
return self._modified_at

@state_property
def refreshed_at(self) -> datetime:
"""Return the last refreshed datetime value."""
return self._refreshed_at

@property
def unconfirmed_last_value_send(self) -> ParameterT:
"""Return the unconfirmed value send for the data_point."""
Expand Down

0 comments on commit d91d83a

Please sign in to comment.