|
20 | 20 | _LOGGER = logging.getLogger(__name__) |
21 | 21 |
|
22 | 22 | FEATURES_CIRCLE_PLUS = ( |
| 23 | + NodeFeature.CIRCLE, |
| 24 | + NodeFeature.CIRCLEPLUS, |
23 | 25 | NodeFeature.RELAY, |
24 | 26 | NodeFeature.RELAY_INIT, |
25 | 27 | NodeFeature.RELAY_LOCK, |
26 | 28 | NodeFeature.ENERGY, |
27 | 29 | NodeFeature.POWER, |
28 | | - NodeFeature.CIRCLE, |
29 | | - NodeFeature.CIRCLEPLUS, |
30 | 30 | ) |
31 | 31 |
|
| 32 | + |
32 | 33 | class PlugwiseCirclePlus(PlugwiseCircle): |
33 | 34 | """Plugwise Circle+ node.""" |
34 | 35 |
|
35 | 36 | async def load(self) -> bool: |
36 | 37 | """Load and activate Circle+ node features.""" |
37 | 38 | if self._loaded: |
38 | 39 | return True |
39 | | - if self._cache_enabled: |
40 | | - _LOGGER.debug("Loading Circle node %s from cache", self._node_info.mac) |
41 | | - if await self._load_from_cache(): |
42 | | - self._loaded = True |
43 | | - self._setup_protocol(CIRCLE_PLUS_FIRMWARE_SUPPORT, FEATURES_CIRCLE_PLUS) |
44 | | - if await self.initialize(): |
45 | | - await self._loaded_callback(NodeEvent.LOADED, self.mac) |
46 | | - return True |
47 | | - |
48 | | - _LOGGER.info( |
49 | | - "Loading Circle+ node %s from cache failed", |
50 | | - self._node_info.mac, |
51 | | - ) |
52 | | - else: |
53 | | - _LOGGER.debug("Loading Circle+ node %s", self._node_info.mac) |
54 | | - |
55 | | - # Check if node is online |
56 | | - if not self._available and not await self.is_online(): |
57 | | - _LOGGER.warning( |
58 | | - "Failed to load Circle+ node %s because it is not online", |
59 | | - self._node_info.mac, |
60 | | - ) |
61 | | - return False |
62 | 40 |
|
63 | | - # Get node info |
64 | | - if await self.node_info_update() is None: |
65 | | - _LOGGER.warning( |
66 | | - "Failed to load Circle+ node %s because it is not responding to information request", |
67 | | - self._node_info.mac, |
68 | | - ) |
| 41 | + _LOGGER.debug("Loading Circle + node %s", self._node_info.mac) |
| 42 | + if not await super().load(): |
| 43 | + _LOGGER.debug("Loading of Circle base node failed") |
69 | 44 | return False |
70 | 45 |
|
71 | | - self._loaded = True |
72 | 46 | self._setup_protocol(CIRCLE_PLUS_FIRMWARE_SUPPORT, FEATURES_CIRCLE_PLUS) |
73 | | - if not await self.initialize(): |
74 | | - return False |
| 47 | + if await self.initialize(): |
| 48 | + await self._loaded_callback(NodeEvent.LOADED, self.mac) |
| 49 | + return True |
75 | 50 |
|
76 | | - await self._loaded_callback(NodeEvent.LOADED, self.mac) |
77 | | - return True |
| 51 | + _LOGGER.debug("Loading of Circle + node %s failed", self._node_info.mac) |
| 52 | + return False |
78 | 53 |
|
79 | 54 | async def clock_synchronize(self) -> bool: |
80 | 55 | """Synchronize realtime clock. Returns true if successful.""" |
|
0 commit comments