Skip to content

Commit 8360b5c

Browse files
committed
chore: inverse boolean logic to match variable naming
1 parent 30b6059 commit 8360b5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roborock/cloud_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _mqtt_on_connect(
114114
connection_queue.set_result(True)
115115

116116
def _mqtt_on_message(self, *args, **kwargs):
117-
self.received_message_since_last_disconnect = False
117+
self.received_message_since_last_disconnect = True
118118
client, __, msg = args
119119
try:
120120
messages = self._decoder(msg.payload)
@@ -238,13 +238,13 @@ async def _validate_connection(self) -> None:
238238
# If we should no longer keep the current connection alive...
239239
if not self.should_keepalive():
240240
self._logger.info("Resetting Roborock connection due to keepalive timeout")
241-
if self.received_message_since_last_disconnect:
241+
if not self.received_message_since_last_disconnect:
242242
# If we have already tried to unsub and resub, and we are still in this state,
243243
# we should try to reconnect.
244244
return await self._reconnect()
245245
try:
246246
# Mark that we have tried to unsubscribe and resubscribe
247-
self.received_message_since_last_disconnect = True
247+
self.received_message_since_last_disconnect = False
248248
if await self._unsubscribe() != 0:
249249
# If we fail to unsubscribe, reconnect to the broker
250250
return await self._reconnect()

0 commit comments

Comments
 (0)