@@ -68,7 +68,6 @@ def __init__(
6868 send_fn : Callable [[PlugwiseRequest , bool ], Awaitable [PlugwiseResponse | None ]]
6969 | None ,
7070 mac : bytes | None ,
71- node_response = True ,
7271 ) -> None :
7372 """Initialize request message."""
7473 super ().__init__ ()
@@ -106,11 +105,9 @@ def __init__(
106105 self ._unsubscribe_node_response : Callable [[], None ] | None = None
107106 self ._response_timeout : TimerHandle | None = None
108107 self ._response_future : Future [PlugwiseResponse ] | None = None
109- if node_response :
110- self ._response_future = self ._loop .create_future ()
108+ self ._response_future = self ._loop .create_future ()
111109 self ._waiting_for_response = False
112110
113- self .node_response_expected : bool = node_response
114111
115112 def __repr__ (self ) -> str :
116113 """Convert request into writable str."""
@@ -176,13 +173,12 @@ async def subscribe_to_response(
176173 self ._unsubscribe_stick_response = await stick_subscription_fn (
177174 self ._process_stick_response , self ._seq_id , None
178175 )
179- if self .node_response_expected :
180- self ._unsubscribe_node_response = await node_subscription_fn (
181- self .process_node_response ,
182- self ._mac ,
183- (self ._reply_identifier ,),
184- self ._seq_id ,
185- )
176+ self ._unsubscribe_node_response = await node_subscription_fn (
177+ self .process_node_response ,
178+ self ._mac ,
179+ (self ._reply_identifier ,),
180+ self ._seq_id ,
181+ )
186182
187183 def _unsubscribe_from_stick (self ) -> None :
188184 """Unsubscribe from StickResponse messages."""
@@ -227,8 +223,7 @@ def _response_timeout_expired(self, stick_timeout: bool = False) -> None:
227223 )
228224 self ._seq_id = None
229225 self ._unsubscribe_from_stick ()
230- if self .node_response_expected :
231- self ._unsubscribe_from_node ()
226+ self ._unsubscribe_from_node ()
232227 if stick_timeout :
233228 self ._response_future .set_exception (
234229 StickTimeout (f"USB-stick responded with time out to { self } " )
@@ -244,8 +239,7 @@ def assign_error(self, error: BaseException) -> None:
244239 """Assign error for this request."""
245240 self .stop_response_timeout ()
246241 self ._unsubscribe_from_stick ()
247- if self .node_response_expected :
248- self ._unsubscribe_from_node ()
242+ self ._unsubscribe_from_node ()
249243 if self ._response_future .done ():
250244 return
251245 self ._waiting_for_response = False
@@ -274,8 +268,7 @@ async def process_node_response(self, response: PlugwiseResponse) -> bool:
274268 self ._response = copy (response )
275269 self .stop_response_timeout ()
276270 self ._unsubscribe_from_stick ()
277- if self .node_response_expected :
278- self ._unsubscribe_from_node ()
271+ self ._unsubscribe_from_node ()
279272 if self ._send_counter > 1 :
280273 _LOGGER .debug (
281274 "Received %s after %s retries as reply to %s" ,
0 commit comments