rand256/valetudo

MQTT Connection Refusal

eeshaan opened this issue · 6 comments

Describe the bug
I'm new to HomeAssistant and was hoping to get Valetudo RE working with it. Unfortunately, I'm running into the following error.

2021-08-01T00:31:19.743Z MQTT Error : mqtt_general_error : {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"192.168.254.149","port":1883}

It seems like someone else received this error message in the logs of an unrelated issue. Could this indicate that it's an issue with the current version of Valetudo?

Vacuum Model
Roborock S5

Valetudo Version:
0.10.7

Additional context

Logs:

2021-08-01T00:31:30.810Z MQTT Error : mqtt_general_error : {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"192.168.254.149","port":1883}
2021-08-01T00:31:19.743Z MQTT Error : mqtt_general_error : {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"192.168.254.149","port":1883}
... [repeats 10s of times]
2021-08-01T00:26:22.857Z scheduled cleaning timezone offset set to -300
2021-08-01T00:26:22.759Z setting scheduled cleaning timezone to America/Chicago
2021-08-01T00:26:21.939Z MQTT Error : mqtt_general_error : {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"192.168.254.149","port":1883}
2021-08-01T00:26:21.353Z Probed last id = 1003 using get_status (52 retries)
2021-08-01T00:26:21.214Z Timesync packet received
2021-08-01T00:26:21.210Z Robot connected
2021-08-01T00:26:13.022Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2021-08-01T00:26:01.663Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2021-08-01T00:26:01.659Z Failed to get handshake for message: get_timezone [] { retries: 0, retriesHS: 100 }
2021-08-01T00:25:57.579Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2021-08-01T00:25:53.318Z tgBot: probeV6 finished with: v4
2021-08-01T00:25:41.766Z Webserver is running on port 80 (http)
2021-08-01T00:25:41.761Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053
2021-08-01T00:25:41.682Z No ssl key found. Expected path: /mnt/data/valetudo/key.pem
2021-08-01T00:25:41.681Z No ssl cert found. Expected path: /mnt/data/valetudo/cert.pem
2021-08-01T00:25:41.457Z timesync: ntpd: setting time to 2021-08-01 02:25:41.425454 (offset -14.168235s)
2021-08-01T00:25:54.340Z Loading configuration file: /mnt/data/valetudo/config.json

/mnt/data/valetudo/config.json:

  "mqtt": {
    "enabled": true,
    "identifier": "rockrobo",
    "topicPrefix": "valetudo",
    "autoconfPrefix": "homeassistant",
    "broker_url": "mqtt://[user]:[pass]@192.168.254.149:1883",
    "provideMapData": true,
    "caPath": "",
    "qos": 0
  }

Could this indicate that it's an issue with the current version of Valetudo?

I don't think so, the error message indicates a problem while establishing the connection to your mqtt broker. Your broker seems to refuse the connection with your given settings. It may be a problem of a wrong broker IP (192.168.254.149) or a wrong port number 1883 or an error in the combination of username/pass...

It seems like someone else received this error message in the logs of an unrelated issue. Could this indicate that it's an issue with the current version of Valetudo?

Could this indicate that it's an issue with the current version of Valetudo?

I don't think so, the error message indicates a problem while establishing the connection to your mqtt broker. Your broker seems to refuse the connection with your given settings. It may be a problem of a wrong broker IP (192.168.254.149) or a wrong port number 1883 or an error in the combination of username/pass...

@eeshaan You have to make sure you don't include certain special characters, like "!" "@" "#"in the password or username, because the MQTT.js client is not able to parse them.

@pidator
The error appears in the logs regardless of whether my HomeAssistant server is turned on, so I think it might be an issue with the MQTT client itself. Interestingly, I also can't connect via the Miio Dummycloud using the API key in the Valetudo settings either, so I think there are issues with the networking of my device more generally. Are there any ports that need to be opened on the isolated network I use for the robot besides TCP 80, 8080, 22, 1883, and 8053?

I think these log messages are particularly interesting.

2021-08-01T00:26:13.022Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2021-08-01T00:26:01.663Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }
2021-08-01T00:26:01.659Z Failed to get handshake for message: get_timezone [] { retries: 0, retriesHS: 100 }
2021-08-01T00:25:57.579Z Failed to get handshake for message: get_status [] { retries: 0, retriesHS: 100 }

@mihsu81-hacs
I've verified that the password is correct and doesn't contain any special characters. Thank you for this advice, though.

ECONNREFUSED clearly states that the device is disallowed to connect to the address:port specified for mqtt broker.

By default firewall on the vacuum itself doesn't restrict arbitrary outgoing connections, so I assume it's either misconfigured firewall on mqtt broker's host, or wrong IP of the host, or the settings of your isolated network forbid the device to connect there.

As for "Failed to get handshake" messages, they can be ignored as the device eventually succeeds in getting them. These messages appear because manufacturer's software is somewhat slow to start up after the device boots.

It seems like someone else received this error message in the logs of an unrelated issue. Could this indicate that it's an issue with the current version of Valetudo?

Could this indicate that it's an issue with the current version of Valetudo?

I don't think so, the error message indicates a problem while establishing the connection to your mqtt broker. Your broker seems to refuse the connection with your given settings. It may be a problem of a wrong broker IP (192.168.254.149) or a wrong port number 1883 or an error in the combination of username/pass...

@eeshaan You have to make sure you don't include certain special characters, like "!" "@" "#"in the password or username, because the MQTT.js client is not able to parse them.

Helped me ! thanks. I have also problem, my password for mqtt ends with symbol # that was the problem.

The issue was with my MQTT broker all along — namely the fact that I didn't have one running at that IP address. 😅