I'm trying to connect to my Roomba 980 directly using MQTT, but I'm not having any luck. I was hoping someone here with more experience using MQTT could help give me some guidance.
For context, I have dorita980 and rest980 installed on a Raspberry Pi, and I use that within Hubitat to control my Roomba. It works great, but it drives me nuts that it has to poll the REST API, rather than directly subscribing via MQTT. I've run out of other HA projects to do, so I thought I'd try to see if I could write a driver that connects directly to the Roomba via MQTT, just for fun.
I've been browsing the dorita980 code on Github, and the code to connect via MQTT seems really straightforward:
const url = 'tls://' + host;
var options = {
port: 8883,
clientId: user,
rejectUnauthorized: false,
protocolId: 'MQTT',
protocolVersion: 4,
ciphers: process.env.ROBOT_CIPHERS || 'AES128-SHA256',
clean: false,
username: user,
password: password
};
const client = mqtt.connect(url, options);
I believe host
is simply the IP address of my Roomba, user
is the blid, and password
comes from the Roomba. I have all of these things in the configuration of rest980, and I can confirm that they're working there.
I borrowed code from @dman2306 to create a very simple driver to test the connection:
https://community.hubitat.com/t/my-god-anyone-attempted-an-lg-thinq-integration/51925/257
and I changed the hostname, port, username, and password to match the information used in rest980.
But the only response I ever get is:
Unable to connect to server (32103) - java.net.ConnectException: Connection refused (Connection refused)
I thought I might be doing something wrong with the driver in Hubitat, so I tried testing the connection in MQTT Explorer, but I get a similar response there:
I wondered if it has to do with the ciphers specified in dorita980, but I can't find anywhere to enter that information in MQTT Explorer. It only has options for the CA certificate, client certificate, and client key (just like the MQTT API in Hubitat).
Does anyone know what I could be doing wrong? I'm pretty far out of my league on this one, so any advice is appreciated!