1919
2020_LOGGER = logging .getLogger (__name__ )
2121
22+ FEATURES_CIRCLE_PLUS = (
23+ NodeFeature .RELAY ,
24+ NodeFeature .RELAY_INIT ,
25+ NodeFeature .RELAY_LOCK ,
26+ NodeFeature .ENERGY ,
27+ NodeFeature .POWER ,
28+ NodeFeature .CIRCLE ,
29+ NodeFeature .CIRCLEPLUS ,
30+ )
2231
2332class PlugwiseCirclePlus (PlugwiseCircle ):
2433 """Plugwise Circle+ node."""
@@ -31,21 +40,11 @@ async def load(self) -> bool:
3140 _LOGGER .debug ("Loading Circle node %s from cache" , self ._node_info .mac )
3241 if await self ._load_from_cache ():
3342 self ._loaded = True
34- self ._setup_protocol (
35- CIRCLE_PLUS_FIRMWARE_SUPPORT ,
36- (
37- NodeFeature .RELAY ,
38- NodeFeature .RELAY_INIT ,
39- NodeFeature .RELAY_LOCK ,
40- NodeFeature .ENERGY ,
41- NodeFeature .POWER ,
42- NodeFeature .CIRCLE ,
43- NodeFeature .CIRCLEPLUS ,
44- ),
45- )
43+ self ._setup_protocol (CIRCLE_PLUS_FIRMWARE_SUPPORT , FEATURES_CIRCLE_PLUS )
4644 if await self .initialize ():
4745 await self ._loaded_callback (NodeEvent .LOADED , self .mac )
4846 return True
47+
4948 _LOGGER .info (
5049 "Loading Circle+ node %s from cache failed" ,
5150 self ._node_info .mac ,
@@ -68,21 +67,12 @@ async def load(self) -> bool:
6867 self ._node_info .mac ,
6968 )
7069 return False
70+
7171 self ._loaded = True
72- self ._setup_protocol (
73- CIRCLE_PLUS_FIRMWARE_SUPPORT ,
74- (
75- NodeFeature .RELAY ,
76- NodeFeature .RELAY_INIT ,
77- NodeFeature .RELAY_LOCK ,
78- NodeFeature .ENERGY ,
79- NodeFeature .POWER ,
80- NodeFeature .CIRCLE ,
81- NodeFeature .CIRCLEPLUS ,
82- ),
83- )
72+ self ._setup_protocol (CIRCLE_PLUS_FIRMWARE_SUPPORT , FEATURES_CIRCLE_PLUS )
8473 if not await self .initialize ():
8574 return False
75+
8676 await self ._loaded_callback (NodeEvent .LOADED , self .mac )
8777 return True
8878
0 commit comments