Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for FW 3 and Braava robots. #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# rest980
[![Build Status](https://travis-ci.org/koalazak/rest980.svg?branch=master)](https://travis-ci.org/koalazak/rest980)

rest980 create a http server to map all [dorita980](https://github.com/koalazak/dorita980) methods in a REST API to control your iRobot Roomba 900 series 980 / i7 / i7+ via HTTP requests.
rest980 create a http server to map all [dorita980](https://github.com/koalazak/dorita980) methods in a REST API to control your iRobot Roomba 900 series 980 / i7 / i7+ or Braava m6 via HTTP requests.

## Install
```bash
Expand All @@ -23,7 +23,7 @@ The service can be configured by editing `config/default.json` or by setting env
|blid|BLID|*(required)* The Roomba blid. *|
|password|PASSWORD|*(required)* The Roomba password. *|
|robotIP|ROBOT_IP|*(optional)* Set if you know your robot IP to skip discovery and speed up startup.|
|firmwareVersion|FIRMWARE_VERSION|*(optional)* Set to 1 or 2 depends of your robot firmware version. Use `2` for any firmware >=2 (yes, use 2 if you have firmware version 3). Default to 1 for firmware 1.6.6|
|firmwareVersion|FIRMWARE_VERSION|*(optional)* Set to 1, 2 or 3 depending of your robot firmware version. Default to 1 for firmware 1.6.6|
|enableLocal|ENABLE_LOCAL|*(optional)* Set to 'no' if you want to disable local API. Default 'yes'.|
|enableCloud|ENABLE_CLOUD|*(optional)* Set to 'no' if you want to disable cloud API. Default 'yes'.|
|keepAlive|KEEP_ALIVE|*(optional)* Set to 'no' if you want to connect and disconnect to the robot in each request (slow but leave the connection free for the official mobile app).|
Expand Down
2 changes: 1 addition & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (sslKeyFile && sslCertFile) {
* Listen on provided port, on all network interfaces.
*/

server.listen(port);
server.listen(port, "0.0.0.0");
server.on('error', onError);
server.on('listening', onListening);

Expand Down
5 changes: 4 additions & 1 deletion public/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ function messageHandler (msg) {
msg.ok = msg.cleanMissionStatus;
msg.ok.pos = msg.pose;
msg.ok.batPct = msg.batPct;
$('#bin').html(msg.bin.present);
if (msg.bin) { $('#bin').html(msg.bin.present); $('#binRow').show(); } else { $('#binRow').hide(); }
if (msg.detectedPad) { $('#detectedPad').html(msg.detectedPad); $('#detectedPadRow').show(); } else { $('#detectedPadRow').hide(); }
if (msg.mopReady) { $('#tankPresent').html(msg.mopReady.tankPresent); $('#tankPresentRow').show(); } else { $('#tankPresentRow').hide(); }
if (msg.mopReady) { $('#lidClosed').html(msg.mopReady.lidClosed); $('#lidClosedRow').show(); } else { $('#lidClosedRow').hide(); }
$('#nMssn').html(msg.ok.nMssn);
}
msg.ok.time = new Date().toISOString();
Expand Down
3 changes: 2 additions & 1 deletion routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ router.get('/local/info/sku', map2dorita('local', 'getSKU'));
router.get('/local/info/wireless', map2dorita('local', 'getWirelessStatus'));
router.get('/local/info/lastwireless', map2dorita('local', 'getWirelessLastStatus'));
router.get('/local/info/mission', map2dorita('local', 'getMission'));
router.get('/local/info/model', map2dorita('local', 'getModel'));
router.get('/local/info/sys', map2dorita('local', 'getSys'));

if (firmwareVersion === 2) {
if (firmwareVersion > 1) {
router.get('/local/info/state', map2dorita('local', 'getRobotState'));
}

Expand Down
5 changes: 4 additions & 1 deletion views/map.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ var updateEvery = <%=mapvalues.pointIntervalMs%>;
Last point: <span class='data' id='last'></span><br/>
Mission Time: <span class='data' id='mission'></span>min<br/>
Mission: <span class='data' id='nMssn'></span><br/>
Bin present: <span class='data' id='bin'></span><br/>
<span id='binRow'>Bin present: <span class='data' id='bin'></span><br/></span>
<span id='detectedPadRow'>Detected pad: <span class='data' id='detectedPad'></span><br/></span>
<span id='tankPresentRow'>Tank present: <span class='data' id='tankPresent'></span><br/></span>
<span id='lidClosedRow'>Lid closed: <span class='data' id='lidClosed'></span><br/></span>
Cycle: <span class='data' id='cycle'></span><br/>
Phase: <span class='data' id='phase'></span><br/>
Flags: <span class='data' id='flags'></span><br/>
Expand Down