File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -667,16 +667,16 @@ async def set_relay_lock(self, state: bool) -> bool:
667667
668668 async def _relay_load_from_cache (self ) -> bool :
669669 """Load relay state from cache."""
670+ result = True
670671 if (cached_relay_data := self ._get_cache (CACHE_RELAY )) is not None :
671672 _LOGGER .debug (
672673 "Restore relay state from cache for node %s: relay: %s" ,
673674 self ._mac_in_str ,
674675 cached_relay_data ,
675676 )
676677
677- relay_state = False if cached_relay_data == "True" else True
678+ relay_state = cached_relay_data != "True"
678679 await self ._relay_update_state (relay_state )
679- result = True
680680 else :
681681 _LOGGER .debug (
682682 "Failed to restore relay state from cache for node %s, try to request node info..." ,
@@ -691,7 +691,7 @@ async def _relay_load_from_cache(self) -> bool:
691691 self ._mac_in_str ,
692692 cached_relay_lock ,
693693 )
694- relay_lock = False if cached_relay_lock == "True" else True
694+ relay_lock = cached_relay_lock != "True"
695695 await self ._relay_update_lock (relay_lock )
696696 else :
697697 # Set to initial state False when not present in cache
You can’t perform that action at this time.
0 commit comments