Skip to content

Commit 92e967a

Browse files
committed
Write initial current_log_address to cache at starting
1 parent 0d17ad2 commit 92e967a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,16 @@ async def node_info_update(
955955
await self._relay_update_state(
956956
node_info.relay_state, timestamp=node_info.timestamp
957957
)
958-
if self._current_log_address is not None and (
958+
if self._current_log_address is None:
959+
if node_info.current_logaddress_pointer:
960+
self._set_cache(
961+
CACHE_CURRENT_LOG_ADDRESS,
962+
node_info.current_logaddress_pointer,
963+
)
964+
await self.save_cache()
965+
elif (
959966
self._current_log_address > node_info.current_logaddress_pointer
960-
or self._current_log_address == 1
967+
or self._current_log_address == 0
961968
):
962969
# Rollover of log address
963970
_LOGGER.debug(
@@ -966,6 +973,7 @@ async def node_info_update(
966973
node_info.current_logaddress_pointer,
967974
self._mac_in_str,
968975
)
976+
969977
if self._current_log_address != node_info.current_logaddress_pointer:
970978
self._current_log_address = node_info.current_logaddress_pointer
971979
self._set_cache(

0 commit comments

Comments
 (0)