1- """All known request messages to be send to plugwise devices."""
1+ """All known request messages to be sent to plugwise devices."""
22
33from __future__ import annotations
44
5858
5959
6060class PlugwiseRequest (PlugwiseMessage ):
61- """Base class for request messages to be send from by USB-Stick."""
61+ """Base class for request messages to be sent from by USB-Stick."""
6262
6363 _reply_identifier : bytes = b"0000"
6464
@@ -215,7 +215,7 @@ def _response_timeout_expired(self, stick_timeout: bool = False) -> None:
215215 if self ._response_future .done ():
216216 return
217217 if stick_timeout :
218- _LOGGER .info ("USB-stick response timeout to %s" , self )
218+ _LOGGER .info ("USB-stick response timeout fot %s" , self )
219219 else :
220220 _LOGGER .info (
221221 "No response received for %s within %s seconds" , self , NODE_TIME_OUT
@@ -225,12 +225,12 @@ def _response_timeout_expired(self, stick_timeout: bool = False) -> None:
225225 self ._unsubscribe_from_node ()
226226 if stick_timeout :
227227 self ._response_future .set_exception (
228- StickTimeout (f"USB-stick response timeout to { self } " )
228+ StickTimeout (f"USB-stick response timeout for { self } " )
229229 )
230230 else :
231231 self ._response_future .set_exception (
232232 NodeTimeout (
233- f"No device response to { self } within { NODE_TIME_OUT } seconds"
233+ f"No device response for { self } within { NODE_TIME_OUT } seconds"
234234 )
235235 )
236236
@@ -249,16 +249,17 @@ async def process_node_response(self, response: PlugwiseResponse) -> bool:
249249 if self ._seq_id is None :
250250 _LOGGER .warning (
251251 "Received %s as reply to %s without a seq_id assigned" ,
252- self . _response ,
252+ response ,
253253 self ,
254254 )
255255 return False
256256 if self ._seq_id != response .seq_id :
257257 _LOGGER .warning (
258- "Received %s as reply to %s which is not correct (expected seq_id=%s )" ,
259- self . _response ,
258+ "Received %s as reply to %s with mismatched seq_id (expected=%r, got=%r )" ,
259+ response ,
260260 self ,
261- str (self .seq_id ),
261+ self .seq_id ,
262+ response .seq_id ,
262263 )
263264 return False
264265 if self ._response_future .done ():
@@ -297,12 +298,12 @@ async def _process_stick_response(self, stick_response: StickResponse) -> None:
297298 return
298299
299300 if stick_response .ack_id == StickResponseType .FAILED :
301+ prev_seq_id = self ._seq_id
300302 self ._unsubscribe_from_node ()
301303 self ._seq_id = None
302304 self ._response_future .set_exception (
303- NodeError (f"Stick failed request { self . _seq_id } " )
305+ NodeError (f"Stick failed request { prev_seq_id !r } " )
304306 )
305- return
306307
307308 _LOGGER .debug (
308309 "Unknown StickResponseType %s at %s for request %s" ,
0 commit comments