Project Icon

rest980

Roomba扫地机器人HTTP控制接口

rest980项目创建了一个HTTP服务器,将dorita980库的功能转换为REST API,用于控制Roomba 900系列、980、i7和i7+扫地机器人。支持本地和云端API,实现清扫、停止、暂停等操作。项目还包含实时地图显示功能,便于监控清扫进度。支持Docker部署,配置灵活,适合智能家居应用。

rest980

rest980 create a http server to map all dorita980 methods in a REST API to control your iRobot Roomba 900 series 980 / i7 / i7+ via HTTP requests.

Install

$ git clone https://github.com/koalazak/rest980.git
$ cd rest980
$ npm install

Fimrware version

Check your robot firmware version! and set your firmware version in firmwareVersion rest980 configuration!

Configuration

The service can be configured by editing config/default.json or by setting environment variables.

Config File (config/default.json)EnvironmentDescription
portPORT(default:3000) The HTTP port to listen on.
blidBLID(required) The Roomba blid. *
passwordPASSWORD(required) The Roomba password. *
robotIPROBOT_IP(optional) Set if you know your robot IP to skip discovery and speed up startup.
firmwareVersionFIRMWARE_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
enableLocalENABLE_LOCAL(optional) Set to 'no' if you want to disable local API. Default 'yes'.
enableCloudENABLE_CLOUD(optional) Set to 'no' if you want to disable cloud API. Default 'yes'.
keepAliveKEEP_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).
basicAuthUserBASIC_AUTH_USER(optional) Set to enable basic auth. Both user and pass must be set.
basicAuthPassBASIC_AUTH_PASS(optional) Set to enable basic auth. Both user and pass must be set.
sslKeyFileSSL_KEY_FILE(optional) Set path to key file to enable HTTPS. Both key and cert must be set. (how to create self signed cert)
sslCertFileSSL_CERT_FILE(optional) Set path to cert file to enable HTTPS. Both key and cert must be set. (how to create self signed cert)

See dorita980 for more information and instructions for obtaining your robot blid and password

Start API Server

$ cd rest980
$ DEBUG=rest980:* npm start
rest980:server Listening on port 3000

omit DEBUG=rest980:* if you want. You can just run with npm start

Or use Docker Image

You can use koalazak/rest980 docker image to run this server in a docker container. Usefull to run on Synology for example.

Pull Docker image:

docker pull koalazak/rest980

Run Docker image:

docker run -e BLID=myuser -e PASSWORD=mypass -e ROBOT_IP=myrobotIP koalazak/rest980

Dockerfile

Also you can local build and test in Docker from this Dockerfile

docker build . -t koalazak/rest980 

API documentation

Now you can make request to this server on port 3000. There are 2 main endpoints: local and cloud, mapped to dorita980 local and cloud methods as well.

Error responses:

HTTP status 500 and response:

{"message":"human message","error":{}}

Local

Actions

All cleaning actions are under /api/local/action/[action] endpoint using GET method without query params:

Available actions:

  • start
  • stop
  • pause
  • dock
  • resume
  • cleanRoom

Example: start to clean

GET http://192.168.1.110:3000/api/local/action/start

Success Response:

{"ok":null,"id":23}

Example: clean a specific room

Some roomba types support "room specificic cleaning" - at the time of writing, at least the s9 and the i7 support this featrue. Assuming you have this model, and have a "Smart Map" for the floor you're trying to clean, you can send room specific cleaning commands. The easiest way to find out the values for this is to start a room specific clean via the app, and then look at the state endpoint (documented below) and find the lastCommand entry. Using this, you can find the room ids. These seem to be stable over time, unless a re-training or new smart map is saved.

The pmap_id and user_pmapv_id are also derived from the same lastCommand trick. These also seem to be stable - unless a new training run or edit to the smart map happens. It's important to get these correct, else your roomba won't clean.

curl -X POST http://192.168.1.110:3000/api/local/action/cleanRoom -H 'Content-Type: application/json' -d '{"ordered": 0, "pmap_id": "123456", "regions": [{"region_id":"5", "region_name":"Hallway","region_type":"hallway"}], "user_pmapv_id": "987654"}'

Note that this is a POST becuase it has a body, unlike the other related action methods.

Info

All info endpoints are under /api/local/info/[record] using GET method without query params:

Available records:

  • mission
  • wireless
  • lastwireless
  • sys
  • sku
  • state (only in firmware 2)

Example: get current mission variables

GET http://192.168.1.110:3000/api/local/info/mission

Success Response:

{ "ok":
   { "flags": 0,
     "cycle": "none",
     "phase": "charge",
     "pos": { "theta": 179, "point": {"x": 102, "y": -13} },
     "batPct": 99,
     "expireM": 0,
     "rechrgM": 0,
     "error": 0,
     "notReady": 0,
     "mssnM": 0,
     "sqft": 0 },
  "id": 2 }

Configurations

All configuration endpoints are under /api/local/config/[configName] using GET method to get current configuration and POST method to set a new configuration.

Available configName:

  • ptime (only GET in firmware 1)
  • bbrun (only GET)
  • cloud (only GET)
  • langs (only GET. Use preferences to set lang)
  • week
  • time (POST Y GET in firmware 1. Only GET in Firmware 2)
  • preferences
  • carpetBoost/auto (only POST. Use preferences to get current config)
  • carpetBoost/performance (only POST. Use preferences to get current config)
  • carpetBoost/eco (only POST. Use preferences to get current config)
  • edgeClean/on (only POST. Use preferences to get current config)
  • edgeClean/off (only POST. Use preferences to get current config)
  • cleaningPasses/auto (only POST. Use preferences to get current config)
  • cleaningPasses/one (only POST. Use preferences to get current config)
  • cleaningPasses/two (only POST. Use preferences to get current config)
  • alwaysFinish/on (only POST. Use preferences to get current config)
  • alwaysFinish/off (only POST. Use preferences to get current config)

See dorita980 documentation for responses and body params for each method and version firmware.

Examples:

Get preferences in firmware 1:

GET http://192.168.1.110:3000/api/local/config/preferences

Success Response:

{ ok:
   { flags: 1024, // See Cleaning Preferences table in dorita980 documentation.
     lang: 2,
     timezone: 'America/Buenos_Aires',
     name: 'myRobotName',
     cleaningPreferences: {
        carpetBoost: 'auto', // 'auto', 'performance', 'eco'
        edgeClean: true,
        cleaningPasses: '1', // '1', '2', 'auto'
        alwaysFinish: true 
      }
    },
 id: 2 }

See dorita980 documentation for preferences in firmware 2.

Set preferences in firmware 1:

POST http://192.168.1.110:3000/api/local/config/preferences

Body:

{ 
  "flags": 1107, // See Cleaning Preferences table in dorita980 documentation.
  "lang": 2,
  "timezone": "America/Buenos_Aires",
  "name": "myRobotName"
}

Success Response:

{"ok":null,"id":293}

See dorita980 documentation for preferences in firmware 2.

Set cleaning passes to two:

POST http://192.168.1.110:3000/api/local/config/cleaningPasses/two

Body:

{}

Success Response:

{"ok":null,"id":293}

Cloud (only for firmware 1.6.x)

Use GET in all info endpoints without query params:

  • /api/cloud/info/status
  • /api/cloud/info/history
  • /api/cloud/info/missionHistory

Use GET in all action endpoints without query params:

  • /api/cloud/action/clean
  • /api/cloud/action/quick
  • /api/cloud/action/spot
  • /api/cloud/action/dock
  • /api/cloud/action/start
  • /api/cloud/action/stop
  • /api/cloud/action/pause
  • /api/cloud/action/resume
  • /api/cloud/action/wake
  • /api/cloud/action/reset
  • /api/cloud/action/find
  • /api/cloud/action/wipe
  • /api/cloud/action/sleep
  • /api/cloud/action/off
  • /api/cloud/action/fbeep

Example:

GET http://192.168.1.110:3000/api/cloud/action/clean

Success Response:

{"status":"OK","method":"multipleFieldSet"}

Host images or files

You can add images or files to public/ folder to serve static files.

Realtime Map (experimental)

Visiting http://serverIP:3000/map with your browser you can play with this cool experiment

/map

iRobot Roomba 980 cleaning map using dorita980 lib

Video: Realtime cleaning map

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

稿定AI

稿定设计 是一个多功能的在线设计和创意平台,提供广泛的设计工具和资源,以满足不同用户的需求。从专业的图形设计师到普通用户,无论是进行图片处理、智能抠图、H5页面制作还是视频剪辑,稿定设计都能提供简单、高效的解决方案。该平台以其用户友好的界面和强大的功能集合,帮助用户轻松实现创意设计。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号