Skip to content

Commit 0dd7182

Browse files
authored
Merge pull request #254 from plugwise/relay-lock
Feature Request: add a lock to disable relay-switch-changes (energy devices only)
2 parents 34b787f + ba33eaf commit 0dd7182

File tree

13 files changed

+341
-117
lines changed

13 files changed

+341
-117
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.43.0(.2)
4+
5+
- PR [#254](https://github.com/plugwise/python-plugwise-usb/pull/254):
6+
- Feature Request: add a lock-function to disable relay-switch-changes (energy devices only)
7+
- Fix data not loading from cache at (re)start, store `current_log_address` item to cache
8+
39
## v0.42.1
410

511
- Implement code improvements, extend debug message [#253](https://github.com/plugwise/python-plugwise-usb/pull/247)

plugwise_usb/api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class NodeFeature(str, Enum):
5050
POWER = "power"
5151
RELAY = "relay"
5252
RELAY_INIT = "relay_init"
53+
RELAY_LOCK = "relay_lock"
5354
SWITCH = "switch"
5455
TEMPERATURE = "temperature"
5556

@@ -171,6 +172,13 @@ class RelayConfig:
171172
init_state: bool | None = None
172173

173174

175+
@dataclass(frozen=True)
176+
class RelayLock:
177+
"""Status of relay lock."""
178+
179+
state: bool | None = None
180+
181+
174182
@dataclass(frozen=True)
175183
class RelayState:
176184
"""Status of relay."""
@@ -369,6 +377,13 @@ def relay(self) -> bool:
369377
Raises NodeError when relay feature is not present at device.
370378
"""
371379

380+
@property
381+
def relay_lock(self) -> RelayLock:
382+
"""Last known relay lock state information.
383+
384+
Raises NodeError when relay lock feature is not present at device.
385+
"""
386+
372387
@property
373388
def relay_state(self) -> RelayState:
374389
"""Last known relay state information.
@@ -420,6 +435,9 @@ async def set_relay(self, state: bool) -> bool:
420435
421436
"""
422437

438+
async def set_relay_lock(self, state: bool) -> bool:
439+
"""Change the state of the relay-lock."""
440+
423441
# endregion
424442

425443
# region configuration properties

0 commit comments

Comments
 (0)