Skip to content

Commit 128a0cf

Browse files
committed
Fix node-initialize()
1 parent d708f3c commit 128a0cf

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,12 +849,14 @@ async def initialize(self) -> bool:
849849
)
850850
self._initialized = False
851851
return False
852+
852853
if not self._calibration and not await self.calibration_update():
853854
_LOGGER.debug(
854855
"Failed to initialized node %s, no calibration", self._mac_in_str
855856
)
856857
self._initialized = False
857858
return False
859+
858860
if (
859861
self.skip_update(self._node_info, 30)
860862
and await self.node_info_update() is None
@@ -869,7 +871,9 @@ async def initialize(self) -> bool:
869871
)
870872
self._initialized = False
871873
return False
872-
return await super().initialize()
874+
875+
await super().initialize()
876+
return True
873877

874878
async def node_info_update(
875879
self, node_info: NodeInfoResponse | None = None

plugwise_usb/nodes/node.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,15 @@ async def _load_from_cache(self) -> bool:
398398
return False
399399
return True
400400

401-
async def initialize(self) -> bool:
401+
async def initialize(self) -> None:
402402
"""Initialize node configuration."""
403403
if self._initialized:
404-
return True
404+
return
405+
405406
self._initialization_delay_expired = datetime.now(tz=UTC) + timedelta(
406407
minutes=SUPPRESS_INITIALIZATION_WARNINGS
407408
)
408409
self._initialized = True
409-
return True
410410

411411
async def _available_update_state(
412412
self, available: bool, timestamp: datetime | None = None

plugwise_usb/nodes/scan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ async def initialize(self) -> bool:
110110
"""Initialize Scan node."""
111111
if self._initialized:
112112
return True
113+
113114
self._unsubscribe_switch_group = await self._message_subscribe(
114115
self._switch_group,
115116
self._mac_in_bytes,
116117
(NODE_SWITCH_GROUP_ID,),
117118
)
118-
return await super().initialize()
119+
await super().initialize()
120+
return True
119121

120122
async def unload(self) -> None:
121123
"""Unload node."""

plugwise_usb/nodes/sed.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,14 @@ async def initialize(self) -> bool:
144144
"""Initialize SED node."""
145145
if self._initialized:
146146
return True
147+
147148
self._awake_subscription = await self._message_subscribe(
148149
self._awake_response,
149150
self._mac_in_bytes,
150151
(NODE_AWAKE_RESPONSE_ID,),
151152
)
152-
return await super().initialize()
153+
await super().initialize()
154+
return True
153155

154156
def _load_defaults(self) -> None:
155157
"""Load default configuration settings."""

plugwise_usb/nodes/sense.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ async def initialize(self) -> bool:
7272
"""Initialize Sense node."""
7373
if self._initialized:
7474
return True
75+
7576
self._sense_subscription = await self._message_subscribe(
7677
self._sense_report,
7778
self._mac_in_bytes,
7879
(SENSE_REPORT_ID,),
7980
)
80-
return await super().initialize()
81+
await super().initialize()
82+
return True
8183

8284
async def unload(self) -> None:
8385
"""Unload node."""

plugwise_usb/nodes/switch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ async def initialize(self) -> bool:
6767
"""Initialize Switch node."""
6868
if self._initialized:
6969
return True
70+
7071
self._switch_subscription = await self._message_subscribe(
7172
self._switch_group,
7273
self._mac_in_bytes,
7374
(NODE_SWITCH_GROUP_ID,),
7475
)
75-
return await super().initialize()
76+
await super().initialize()
77+
return True
7678

7779
async def unload(self) -> None:
7880
"""Unload node."""

0 commit comments

Comments
 (0)