File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed
Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -673,34 +673,29 @@ async def _relay_load_from_cache(self) -> bool:
673673 self ._mac_in_str ,
674674 cached_relay_data ,
675675 )
676- relay_state = False
677- if cached_relay_data == "True" :
678- relay_state = True
679676
677+ relay_state = False if cached_relay_data == "True" else True
680678 await self ._relay_update_state (relay_state )
681679 result = True
682-
683- _LOGGER .debug (
684- "Failed to restore relay state from cache for node %s, try to request node info..." ,
685- self ._mac_in_str ,
686- )
687- if await self .node_info_update () is None :
688- result = False
680+ else :
681+ _LOGGER .debug (
682+ "Failed to restore relay state from cache for node %s, try to request node info..." ,
683+ self ._mac_in_str ,
684+ )
685+ if await self .node_info_update () is None :
686+ result = False
689687
690688 if (cached_relay_lock := self ._get_cache (CACHE_RELAY_LOCK )) is not None :
691689 _LOGGER .debug (
692690 "Restore relay_lock state from cache for node %s: relay_lock: %s" ,
693691 self ._mac_in_str ,
694692 cached_relay_lock ,
695693 )
696- relay_lock = False
697- if cached_relay_lock == "True" :
698- relay_lock = True
699-
694+ relay_lock = False if cached_relay_lock == "True" else True
700695 await self ._relay_update_lock (relay_lock )
701-
702- # Set to initial state False when not present in cache
703- await self ._relay_update_lock (False )
696+ else :
697+ # Set to initial state False when not present in cache
698+ await self ._relay_update_lock (False )
704699
705700 return result
706701
You can’t perform that action at this time.
0 commit comments