Hypfer / Valetudo

Cloud replacement for vacuum robots enabling local-only operation
https://valetudo.cloud
Apache License 2.0
6.38k stars 388 forks source link

Valetudo MQTT disconnecting every 2 minutes #2058

Closed szymucha94 closed 4 months ago

szymucha94 commented 5 months ago

What is happening?

In short: my backup solution pauses HAOS VM at 1:30 every Monday causing mqtt disconnect from the vacuum robot after which connections last only for 2 minutes until robot is rebooted. I stayed on one of the 2022 valetudo versions and decided to update to 2024.2 last week. This issue is only visible since yesterday (when the mosquitto broker was paused) - on old versions mqtt was always perfectly stable. Using HA 2023.11.2. Robot is Mijia 1C. Attaching screenshots - please let me know what kinds of other logs you need. Robot is not seen disconnecting from wifi, so this seems like MQTT issue. This is also seen on two identical mijia 1c robots (both running same valetudo versions, both under servers that backup VMs in the same way)

Broken or not as expected?

Broken

What should be happening?

MQTT should reconnect and stay connected with no need to reboot the robot.

How to reproduce

  1. Forcibly pause Mosquitto and let the robot disconnect for a moment
  2. Resume mosquitto, wait for the valetudo to connect
  3. Watch how it reconnects every 2 minutes

Is this Valetudo-related?

Certainly Valetudo-related

Please enter the Valetudo version you're using

2024.2

Please enter the vendor and model of robot you're using

Mijia 1C

Please enter the robot's firmware version you're using

1122

Additional context

Issue is seen on two identical robots. This issue did not happen on old (2022) valetudo versions.

Context reflection

No, it's only the Valetudo version that changed.

Screenshots

mosquitto_logs mqtt availability mqtt timeline_ha val_logs wifi

Hypfer commented 5 months ago

I was indeed able to reproduce the issue.

By pure coincidence, just 3 hours ago(!) there was a new release of the MQTT library used which contains a single bugfix for "keepalive issues": https://github.com/mqttjs/MQTT.js/pull/1855

Please try the latest nightly build and let me know if the issue still persists

szymucha94 commented 5 months ago

I switched to "nightly" update branch and attempted update twice. I'm not sure install worked because updater still pops up with the same nightly built. System information after update: obraz Updater still offers new package: obraz

szymucha94 commented 5 months ago

Well, I think this update attempt broke my robot, or at least this is a very weird coincidence. When attempting to charge it turns on in lower mode and moves a bit in docking station, then complains about charging error. Need to reflash this with official build. (after reflash battery charges fine, I checked logs in previous state and there was nothing worrying. Don't have time to reproduce this and investigate further unfortunately)

Krispkiwi commented 4 months ago

I noticed something similar which may or may not be related. When I would disable entities in home assistant for the vacuum, I'd check and a few hours later they'd be back. As if the vacuum was routinely dropping off and back onto the instance.