Skip to content

Commit 0a7211f

Browse files
committed
Move and protect set_relay_lock()
1 parent 85df557 commit 0a7211f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@ def relay_lock(self) -> RelayLock:
183183
"""State of the relay lock."""
184184
return self._relay_lock
185185

186-
async def set_relay_lock(self, state: bool) -> bool:
187-
"""Set the state of the relay-lock."""
188-
await self._relay_update_lock(state)
189-
await self.publish_feature_update_to_subscribers(
190-
NodeFeature.RELAY_LOCK, state
191-
)
192-
return state
193-
194186
# endregion
195187

196188
async def calibration_update(self) -> bool:
@@ -667,6 +659,15 @@ async def set_relay(self, state: bool) -> bool:
667659
+ "in response to CircleRelaySwitchRequest for node {self.mac}"
668660
)
669661

662+
@raise_not_loaded
663+
async def set_relay_lock(self, state: bool) -> bool:
664+
"""Set the state of the relay-lock."""
665+
await self._relay_update_lock(state)
666+
await self.publish_feature_update_to_subscribers(
667+
NodeFeature.RELAY_LOCK, state
668+
)
669+
return state
670+
670671
async def _relay_load_from_cache(self) -> bool:
671672
"""Load relay state and lock from cache."""
672673
if (cached_relay_data := self._get_cache(CACHE_RELAY)) is not None:

0 commit comments

Comments
 (0)