All API Calls timeout?
dcmeglio opened this issue · 22 comments
Every API call I make to my i7 (app says it has 1.6.6 firmware) says there is a timeout:
GET /api/local/config/preferences - - ms - -
RequestError: Error: connect ETIMEDOUT 192.168.86.38:443
at new RequestError (/home/pi/rest980/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/home/pi/rest980/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/home/pi/rest980/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/home/pi/rest980/node_modules/request/request.js:185:22)
at Request.emit (events.js:189:13)
at Request.onRequestError (/home/pi/rest980/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:189:13)
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
192.168.86.38:443GET /api/local/info/mission - - ms - -
RequestError: Error: connect ETIMEDOUT 192.168.86.38:443
at new RequestError (/home/pi/rest980/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/home/pi/rest980/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/home/pi/rest980/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/home/pi/rest980/node_modules/request/request.js:185:22)
at Request.emit (events.js:189:13)
at Request.onRequestError (/home/pi/rest980/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:189:13)
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
I can't get any of the local API calls to work from rest980. Anything I should be doing? I can ping the robot's IP 192.168.86.38, but nothing seems to be listening on port 443 on its ip, I cannot telnet to it
When I make calls directly to dorita980 instead of rest980 it just doesn't do anything. I tried running the example code listed under "Auto discover IP address for local request" and I just get:
Looking for robots...
Robot found! with blid/username: BLIDHERE
{ ver: '3',
hostname: 'iRobot-BLIDHERE',
robotname: 'Roomba',
robotid: 'BLIDHERE',
ip: '192.168.86.38',
mac: '50:14:79:0E:20:47',
sw: 'lewis+1.6.6+lewis-day-0-ota+29',
sku: 'i715020',
nc: 0,
proto: 'mqtt',
cap:
{ binFullDetect: 1,
dockComm: 1,
maps: 3,
edge: 0,
area: 1,
eco: 1,
multiPass: 2,
pose: 1,
team: 1,
pp: 0,
'5ghz': 1,
prov: 3,
sched: 1,
svcConf: 1,
ota: 2,
log: 2 } }
It never returns the mission.
Further research, even though it says 1.6.6 I noticed my device is listening on 8883 not 443. I tried setting the firmware version to 2 to support this. No dice. I do the following:
curl -X GET http://192.168.86.46:3000/api/local/info/mission
It never returns anything. I do not have the mobile app running anywhere. All that is logged in rest980 is:
GET /api/local/info/mission - - ms - -
Curl eventually just says:
curl: (52) Empty reply from server
i7 with 1.6.6 firmware? that is weird. Regarding your robot info said proto: 'mqtt'
you should use dorita980 for v2 firmware anyway.
- Could you get the password?
- Is your robot fully upgraded to latest version? (you can do that on mobile app)
if you already have the password, try this code:
test.js
var dorita980 = require('dorita980');
var myRobotViaLocal = new dorita980.Local('yourBLID', 'yourPassowrd', '192.168.86.38');
myRobotViaLocal.on('connect', init);
function init () {
myRobotViaLocal.clean()
.then(() => myRobotViaLocal.end())
.catch(console.log);
}
$ npm install dorita980 --save
$ node test.js
please share the complete output, node.js version and dorita980 version.
thanks
each serie has its own firmware version numeration 🤦♂
https://homesupport.irobot.com/app/answers/detail/a_id/550/session/L2F2LzEvdGltZS8xNTY2NzQ0ODU3L3NpZC9mVVZwbjFHZkk0VE52OWNDUDR1MnV2RWFRanR3X1A1UVRfJTdFV3BLNEtSbFJmQXZDeGNNU3FNTUxzTlN1VlVfVlZpZGpHT2M4M24zV3pxVktxaWxNTDI0bXRDbmVjek9vSTg3JTdFQVVwbXo5bUdOWmZwX3hPTXIxTFNnJTIxJTIx
I should change the lib to handle this using "proto" string instead of firmware version number.
Anyway you should use the lib in v2 firmware mode
After both switching to version 2 and also rebooting my robot it's working now. Thanks!
reopening, after rebooting my raspberry pi, same issue again...
Nodejs version v10.15.2
Dorita version 3.1.4
Output of the command:
pi@Roomba-Dorita:~ $ node test.js
Been waiting 10 minutes now, no further output...
Edit: Rebooting the robot fixed it again... something seems weird here. If there is any kind of logging I can pull I'm happy to assist
seems like you have the mobile application opened. Robot can't handle 2 connections a the same time
what you mean with "same issue again"?
Error: connect ETIMEDOUT 192.168.86.38:443
???
i7 with FW 1.6.6 here too, with similar issues.
I'm using the version 2 setting, and got the blid and password OK. With some testing I found that:
/api returns the version OK but no other calls work, they eventually timeout. If you click stop, node returns the attempt to return a URI but nothing else of interest in the console.
test.js as above does work; it starts a clean and does not return any data to the console.
Amending test.js to make other calls seemed not to work, but this code does - as shown on the dorita980 page, to return status every 300ms:
var cleanMissionStatus = 300; // default is 800ms
var dorita980 = require('dorita980');
var myRobotViaLocal = new dorita980.Local('blid', 'password', '192.168.1.145', 2, cleanMissionStatus);
myRobotViaLocal.on('mission', function (data) {
console.log(data);
});
This worked OK so I started a clean mission from the app; the data updated with each refresh as expected. I then found the map page was working too, as was /api/local/info/mission
If I stop the mission and the i7 returns to dock, both the map and mission API call return the expected data. If I close and re-open the browser, again all still working.
If I exit the node instance (in this case, running in an SSH terminal session to an Ubuntu server VM) and start it again with the exact same command, the API goes back to not working (will return version from /api but no other calls work).
It would seem that starting the node API is not initiating the method for some reason. If you start it elsewhere (from node myTestScript.js for example), it does.
Updated after more testing.
If I start the API when the i7 is actually cleaning, it works as expected. Once the mission is complete and the i7 is docked and idle, the API continues working.
If I start the API when the i7 is docked and idle, it does not work. /api returns version but no other calls return data and eventually timeout. Console shows the API returning pages (for example when the map page is requested) but no actual data from the i7 is returned. The map page does not update.
If the API is 'started but not returning data' and a cleaning mission is started from the mobile app, the API starts working, and will continue working even when the i7 is docked and idle again.
The test script above works at all times, even when the i7 is docked and idle. The first call takes a few seconds presumably as the connection is instantiated.
So the issue appears to be that API calls to dorita980 do not work (or don't return data to the API caller) if the API is started when the i7 is docked and idle, until a cleaning mission has started. Dorita980 itself seems to work regardless.
Seems like the keepAlive
option is having problems with i7 robots. Please try setting keepAlive
option to no
Thanks for the suggestion (and for your time on this project).
No change when setting keepAlive
to no
{
"port": 3000,
"blid": "myblid",
"password": "mypassword",
"robotIP": "192.168.1.145",
"firmwareVersion": 2,
"enableLocal": "yes",
"enableCloud": "yes",
"keepAlive": "no",
"basicAuthUser": null,
"basicAuthPass": null,
"sslKeyFile": null,
"sslCertFile": null
}
symptoms are not the same for me. If I reboot my roomba and then connect to the api while docked and idle, all is well.
hello!
you did a gret job! - thanks a lot.
maybe you know what the problem could be.
after DEBUG=rest980:* npm start
the npm is running perfect.
but after a while the connection get lost.
npm fail or roomba fail?
thx!
Same with me. I was able to setup the rest980, was able to retrieve passwords, blid, etc. When opening the mapping (localhost:3000/map) was showing data and was able to start / stop / dock the iRobot 960. But after a couple of minutes the connection is lost and was not able to open the mapping page (no connection). I tried to set the 'KeepAlive' option to 'no' but that did not resolve the issue. If I do 'npm start' the connection is working again, but stops after a couple of minutes.
Any idea what could be the cause?
Regards
@simontims i was having the same symptoms as you -- setting "enableCloud" -> no fixed things for me
@simontims i was having the same symptoms as you -- setting "enableCloud" -> no fixed things for me
mm, strike that, i convinced myself it was working but it was just randomly connecting like you were seeing
it looks like requesting things that need pose
hangs on the i7s --
var dorita980 = require('dorita980');
var myRobotViaLocal = new dorita980.Local(...);
myRobotViaLocal.on('connect', init);
function init () {
// THIS WORKS:
myRobotViaLocal.getBasicMission()
// THIS HANGS:
//myRobotViaLocal.getMission()
.then((result) => {console.log("result:", result); myRobotViaLocal.end()})
.catch(console.log);
}
the only difference between getBasicMission
and getMission
is that getMission
asks about the pose
-- https://github.com/koalazak/dorita980/blob/master/lib/v2/local.js#L121-L122
maybe pose
only finishes when the robot's on mission?
I think it was fixed with the latest push, let me know please, ty!
I just discovered this repo and tried to use it. I have the same issue as described here.
I also tried using dorita980 and it works flawlessly... I have no idea what could be causing this...
Apparently, after a restart I can do one call, then it never respond anymore until I restart the Roomba again.