@@ -884,48 +884,30 @@ async def load(self) -> bool:
884884 _LOGGER .debug ("Loading Circle node %s from cache" , self ._mac_in_str )
885885 if await self ._load_from_cache ():
886886 self ._loaded = True
887- self ._setup_protocol (
888- CIRCLE_FIRMWARE_SUPPORT ,
889- (
890- NodeFeature .CIRCLE ,
891- NodeFeature .RELAY ,
892- NodeFeature .RELAY_INIT ,
893- NodeFeature .RELAY_LOCK ,
894- NodeFeature .ENERGY ,
895- NodeFeature .POWER ,
896- ),
897- )
898- if await self .initialize ():
899- await self ._loaded_callback (NodeEvent .LOADED , self .mac )
900- return True
887+ if not self ._loaded :
888+ _LOGGER .debug ("Retrieving Info For Circle node %s" , self ._mac_in_str )
901889
902- _LOGGER .debug (
903- "Loading Circle node %s from cache failed" ,
904- self ._mac_in_str ,
905- )
906- else :
907- _LOGGER .debug ("Loading Circle node %s" , self ._mac_in_str )
890+ # Check if node is online
891+ if not self ._available and not await self .is_online ():
892+ _LOGGER .debug (
893+ "Failed to load Circle node %s because it is not online" ,
894+ self ._mac_in_str ,
895+ )
896+ return False
908897
909- # Check if node is online
910- if not self ._available and not await self .is_online ():
911- _LOGGER .debug (
912- "Failed to load Circle node %s because it is not online" ,
913- self ._mac_in_str ,
914- )
915- return False
898+ # Get node info
899+ if (
900+ self .skip_update (self ._node_info , 30 )
901+ and await self .node_info_update () is None
902+ ):
903+ _LOGGER .debug (
904+ "Failed to load Circle node %s because it is not responding to information request" ,
905+ self ._mac_in_str ,
906+ )
907+ return False
916908
917- # Get node info
918- if (
919- self .skip_update (self ._node_info , 30 )
920- and await self .node_info_update () is None
921- ):
922- _LOGGER .debug (
923- "Failed to load Circle node %s because it is not responding to information request" ,
924- self ._mac_in_str ,
925- )
926- return False
909+ self ._loaded = True
927910
928- self ._loaded = True
929911 self ._setup_protocol (
930912 CIRCLE_FIRMWARE_SUPPORT ,
931913 (
@@ -937,10 +919,8 @@ async def load(self) -> bool:
937919 NodeFeature .POWER ,
938920 ),
939921 )
940- if not await self .initialize ():
941- return False
942-
943922 await self ._loaded_callback (NodeEvent .LOADED , self .mac )
923+ await self .initialize ()
944924 return True
945925
946926 async def _load_from_cache (self ) -> bool :
0 commit comments