@@ -283,29 +283,34 @@ async def process_node_response(self, response: PlugwiseResponse) -> bool:
283283
284284 async def _process_stick_response (self , stick_response : StickResponse ) -> None :
285285 """Process incoming stick response."""
286- if self ._response_future .done ():
286+ if (
287+ self ._response_future .done ()
288+ or self ._seq_id is None
289+ or self ._seq_id != stick_response .seq_id
290+ ):
287291 return
288292
289- if self . _seq_id is None or self . _seq_id != stick_response . seq_id :
293+ if stick_response . ack_id == StickResponseType . ACCEPT :
290294 return
291295
292296 if stick_response .ack_id == StickResponseType .TIMEOUT :
293297 self ._response_timeout_expired (stick_timeout = True )
294- elif stick_response .ack_id == StickResponseType .FAILED :
298+ return
299+
300+ if stick_response .ack_id == StickResponseType .FAILED :
295301 self ._unsubscribe_from_node ()
296302 self ._seq_id = None
297303 self ._response_future .set_exception (
298304 NodeError (f"Stick failed request { self ._seq_id } " )
299305 )
300- elif stick_response .ack_id == StickResponseType .ACCEPT :
301- pass # Nothing to do for ACCEPT
302- else :
303- _LOGGER .debug (
304- "Unknown StickResponseType %s at %s for request %s" ,
305- str (stick_response .ack_id ),
306- stick_response ,
307- self ,
308- )
306+ return
307+
308+ _LOGGER .debug (
309+ "Unknown StickResponseType %s at %s for request %s" ,
310+ str (stick_response .ack_id ),
311+ stick_response ,
312+ self ,
313+ )
309314
310315 async def _send_request (self , suppress_node_errors = False ) -> PlugwiseResponse | None :
311316 """Send request."""
0 commit comments