koalazak / dorita980

Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
MIT License
964 stars 149 forks source link

j7+ with version 4 not connecting #157

Closed ricardopineda93 closed 8 months ago

ricardopineda93 commented 2 years ago

Just got the j7+ and have been following the docs closely, however running Local and attempting to connect to my Roomba just hangs until I kill. Running nc -zv <roomba ip> 8883 rejects the connection while my script is running and hanging so I am assuming something is happening but not really resolving?

MacOS Monterey 12.2.1 Node 14.8.1 Dorita980 3.1.11 Roomba J7+ (iRobot app says "Robot Software 1.2.12 Updated February 10, 2022". )

Running the discovery command yields:

{ ver: '4', hostname: 'iRobot-XXXX', robotname: 'XXXX', robotid: 'XXX', ip: '192.168.1.8', mac: 'XXXX', sw: 'sapphire+1.2.12+Firmware-Production+57', sku: 'XXXX', nc: 0, proto: 'mqtt', cap: { binFullDetect: 2, oMode: 2, odoa: 2, dockComm: 1, edge: 0, maps: 3, pmaps: 5, tLine: 2, area: 1, eco: 1, multiPass: 2, team: 1, pp: 0, lang: 2, '5ghz': 1, prov: 3, sched: 1, svcConf: 1, ota: 2, log: 2, langOta: 0, expectingUserConf: 1 }, cloudConnState: 14 }

My test script:

` const dorita980 = require("dorita980"); const { blid, password, ip } = require("./config.json");

const roombaLocal = new dorita980.Local(blid, password, ip, 2);

roombaLocal.on("connect", () => { roombaLocal .getSys() .then((sys) => { console.log(sys); roombaLocal.end(); }) .catch((err) => console.error(err)); }); `

nriley commented 2 years ago

I'm getting this too with a j7. Is this working for anyone else? I have no trouble getting the BLID/password from the web service but nothing local seems to connect, even after I tried rebooting the vacuum.

fieldsjm commented 2 years ago

Same here, successfully retrieved BLID/password but timesout when attempt a GET request for data

rcjkierkels commented 2 years ago

Love to see this working for the j7 :-)

jfroy commented 2 years ago

Same problem, with firmware 22.7.2-2022-03-29.

mikesalz commented 2 years ago

I am excited to get this working, but am experiencing the same issue. @koalazak Just curious if you have any thoughts?

st-sha commented 2 years ago

Same issue here. Curious to know is j7 support is in the works.

julianpoy commented 2 years ago

Experiencing the same. @koalazak do you know where I'd start to look into debugging this?

mikesalz commented 2 years ago

@koalazak doesn't seem to reply to inquiries for some reason. This might be helpful... https://community.home-assistant.io/t/roomba-j7-integration-help/339705/28

sjorge commented 1 year ago

Also seeing this with a J7+, I tried the cipher change mentioned but that didn't help. Neither can I say curl the endpoint dorita980 is trying to access.

I also tried blocking the IP from accessing the internet, hoping maybe limited to 1 connection or something and it being taken up by the cloud one, but no change.

vladimir-aubrecht commented 1 year ago

I played with it today and I have some discoveries, hopefully somebody will manage to get closer than me.

First I applied PRs: node tls fix, cyphers fix and update of mqtt library. Can somebody help with them? Maybe @koalazak, can we merge them? 😊

Dorita client is managing to get Roomba J7+ into some weird state which causes, that nothing can connect anymore after some amount of tries. After Roomba J7+ reboot everything works normally; I'll clarify that.

I managed to connect with MQTT Explorer app for MacOS with settings:

With these settings, after reboot of roomba I am able to connect and I can see messages from roomba about battery, signal strength, etc. So I am sure, it's possible to connect there 😊

Unfortunately did not have same luck with Dorita client library where after vacuum reboot I am getting:

Error: connect ECONNREFUSED 192.168.2.13:8883
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1571:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '192.168.2.13',
  port: 8883
}

Did not find what is error -61. One way which should uncover how to fix it could be using some network sniffer tool like Wireshark or something else. It's possible to capture traffic from MQTT Explorer, then capture traffic from Dorita library and compare them to find out differences and reasons why it works from one, but not another. Thou it's almost 6 am here now, so it's a job for another day ... 😊 (actually probably another week/month, I'll not have time to continue on it soon 😕 ).

Zahlii commented 1 year ago

The problem most likely is usage of node after v16, which leads to an internal error "unsafe legacy renegotiation disabled" which you don'rt control on client side. Make sure you are using node 16xxx

vladimir-aubrecht commented 1 year ago

Thank you for suggestion, but unfortunately it seems there is some other problem there. I tried it in two ways:

All testing were performed with Node v16.16.0.

Script which I am using for testing:

var dorita980 = require('dorita980');
console.log("Creating connection");
var myRobotViaLocal = new dorita980.Local('myusername', 'mypassword', 'roomba ip'); // robot IP address

console.log("Registering connect handler");
myRobotViaLocal.on('connect', init);
console.log("Handler registered");

function init () {
    console.log("connected");
}
Screenshot 2023-07-01 at 3 19 18 Screenshot 2023-07-01 at 2 52 18
koalazak commented 1 year ago

hey guys, sorry im late (?) haha

The problem is that I don't have a j7+ robot to test and troubleshoot this connection issue. You might need to play around with the connection options and certificates. I saw that you tried to upgrade mqtt from 2 to 4, keep in mind that there are breaking changes in error handling. Also, try to maintain compatibility with older versions of node.js and old robots if you are going to send PRs. Thank you!

CarComp commented 8 months ago

@koalazak It is happening now on the 980. Can you confirm?

koalazak commented 8 months ago

it is NOT happening on my 980.

tested and working with node version 10, 14 and 20.

robot firmware and discovery info:

{
  ver: '3',
  hostname: 'Roomba-xxxxxxxxxxxx',
  robotname: 'xxxxxx',
  ip: 'x.x.x.x',
  mac: 'xx:xx:xx:xx:xx',
  sw: 'v2.4.17-138',
  sku: 'R98----',
  nc: 1,
  proto: 'mqtt',
  cap: {
    pose: 1,
    ota: 2,
    multiPass: 2,
    carpetBoost: 1,
    pp: 1,
    binFullDetect: 1,
    langOta: 1,
    maps: 1,
    edge: 1,
    eco: 1,
    svcConf: 1
  }
}

Mobile App say that firmware was upgraded on 13 oct 2023 and say there is no new firmware.

Remember the reobot allows only 1 connection at the time (rejecting new connections)

CarComp commented 8 months ago

@koalazak I get that part works perfectly... try the "get schedule" commands from the readme... I can't get anything other than discovery info to work.

myRobotViaLocal.on('connect', init);

function init () {
  console.log("never runs");
}
koalazak commented 8 months ago

that is what I tested and works for me. I am able to connect to the robot and receive the state and send commands. the discovery info was just to show my "setup"