This adapter allows you to control the Xiaomi vacuum cleaner.
This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information how to disable the error reporting see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.
Device | Basic Control | history | rooms | map |
---|---|---|---|---|
viomi.vacuum.v6 | ✔️ | ❌ | ❌ | ❌ |
viomi.vacuum.v7 | ✔️ | ❌ | ❌ | ❌ |
viomi.vacuum.v8 | ✔️ | ❌ | ❌ | ❌ |
rockrobo.vacuum.v1 | ✔️ | ✔️ | ❌ | ✔️ |
roborock.vacuum.s4 | ✔️ | ✔️ | ✔️ | ✔️ |
roborock.vacuum.s5 | ✔️ | ✔️ | ✔️ | ✔️ |
roborock.vacuum.s5e | ✔️ | ✔️ | ✔️ | ✔️ |
roborock.vacuum.m1s | ✔️ | ✔️ | ✔️ | ✔️ |
roborock.vacuum.a10 | ✔️ | ✔️ | ✔️ | ✔️ |
roborock.vacuum.a15 | ✔️ | ✔️ | ✔️ | ✔️ |
dreame.vacuum.r2205 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.r2216o | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.r2228o | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2008 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2009 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2027 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2028 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2029 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2036 | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2041o | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2114a | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2148o | ✔️ | ✔️ | ❌ | ❌ |
dreame.vacuum.p2156o | ✔️ | ✔️ | ❌ | ❌ |
if your installation runs in error. The canvas package could not be installed
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1
Please install canvas and the libs manually with:
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
switch into : cd /opt/iobroker/node_modules/iobroker.mihome-vacuum
then npm install canvas
Sometimes you can't connect to the xiaomi cloud. Please open Browser, go to Mihome and login. Enter the code you received via mail. After that, the connection should work.
PLease be sure, that you robot is connected with the Mihome App and NOT with the Roborock App
Currently there is a problem, if the robot and ioBroker are not use the same subnet.
Currently, finding the token is the biggest problem. One option to extract the token is using this utility: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor
Otherwise please follow the instruction in the Link:
- For IP address, the IP address of the robot must be entered in the format
192.168.178.XX
- The port of the robot is set to "54321" by default, this should not be changed
- Own port, should only be changed with second robot
- Query Interval The time in ms in which the robot's status values are retrieved (should not be <10000)
The special control state clean_home
will be created for Alexa.
It is a switch which starts at true
the sucker and at false
it goes home.
It becomes automatically a smart device in the cloud Adapter created
with the name "vacuum cleaner", which can be changed in the cloud adapter.
With this option enabled, the Vacuum will resume the zone-cleaning when setting the "start" state to true if it was paused during a running zone-clean. If this option is disabled, the vacuum will start a new "normal cleaning" when you send the start command, even if it was paused during a running zone-clean.
- Experimental: Using the checkbox "Send your own commands" objects are created, via which you can send and receive your own commands to the robot.
If two robots are to be controlled via ioBroker, two instances must be created. For the second robot the own port (default: 53421) for IoBroker must changed, so that both robots can archieve ioBroker via different ports.
There are two ways to get the map. The first get the map from the cloud. Therefore, you have to log in and select the right robot from the list
Second way is the map from valetudo (only local connection). Therefore, you have to root and install valetudo to your device. You can use Valetudo RE or normal Valetudo.
- To use the map you have to select valetudo or original map in the config
- Request interval must be more than 1000 ms this is the intervall for update the html map
- Map intervall must be more than 5000 ms this intervall updates the png Map file (you can use this for Telegram or vis or anything else)
- Color there you can select the colors for the map example:
- #2211FF
- rbg(255,200,190)
- rgba(255,100,100,0.5) //for Transparent
- green
- Robots there you can select different robots or other vehicles for the map
The map is stored either as base64-raw or as PNG.
You can find the map image in the following data points:
- base64:
mihome-vacuum.0.cleanmap.map64
- PNG:
mihome-vacuum.0.cleanmap.mapURL
You can use both images as image source in the VIS you want. In HTML-style you can use the image in this way:
<img src="mihome-vacuum.0.cleanmap.map64">
With additional style-tags you can resize and/or format the map style.
To use the map in jarvis
just use one of the data points as URL of the DisplayImage-Widget.
There you can resize the image or the whole widget. In case of the responsive design of jarvis the Map will resize in case of the display size.
To display the map in ioBroker VIS
you can use a normal html Widget e.g:
[{"tpl":"tplHtml","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","refreshInterval":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html":"{mihome-vacuum.0.map.map64}"},"style":{"left":"0","top":"0","width":"100%","height":"100%"},"widgetSet":"basic"}]
The use of the base64-map is faster and will display the position of the robot nearby in realtime.
The card size is always 52000mm x 52000mm thus values from 0 to 51999mm are possible. Unfortunately, the position and location of the card can not be queried, this can change from suction to suction. Used as a basis is always the last suction card, as well as in the app. If the robot only picks up one area and always builds the map the same way, you can reliably send it to places or have the area vacuumed.
In order to drive the vacuum cleaner to a point, the "goTo" object must be filled as follows:
xVal, yval
The values must satisfy the above scope and indicate the x and y coordinates on the map.
Example:
24,850.26500
To vacuum a zone, ZoneClean must be filled as follows:
[X1, y1, x2, x2, count]
Where x and y are the coordinates of the rectangular area and "count" the cleaning operations. You can also let several areas suck at once:
[X1, y1, x2, x2, count], [x3, y3, x4, x4, count2]
Example:
[24117,26005,25767,27205,1], [24320,24693,25970,25843,1]
newer vacuum cleaner with the latest Home App supports the definition of rooms, see Video
Each room in the current map has an index, which is then assigned to the room from the app. From the robot we only get a mapping with room number and index. The adapter queries these rooms every time the adapter starts and creates a channel for each room, which then knows the current room index. The same happens manually with the button loadRooms. This channel can then be assigned to the ioBroker rooms. If the button roomClean is pressed, the index of the card is determined and sent to the robot, so that it can then vacuum this room. Before that the FAN power is set for single room suction. If you don't have the possibility to name the rooms in the app yet, there is also the possibility to create such a channel manually by specifying the map index. It is also possible to add zone coordinates instead of mapIndex. If you want to clean several rooms spontaneously, you can do this via multiRoomClean by assigning the ioBroker rooms to this data point and then pressing the button.
As soon as the vacuum cleaner supports the room function (see above), it is also possible to create timers, which then trigger the corresponding room channels or determine their mapIndexes. The timer could trigger via rooms and/or room channels directly. The timers themselves are created via the config area, but then become a data point. There, each timer can be activated/deactivated or skipped once. A direct start is also possible. The advantage of the ioBroker timers is that they can be displayed and used in the VIS and you can disconnect the robot from the internet, because the timers of the app are triggered from China.
NOTE: This function should only be used by experts, as the sucker might be damaged by wrong commands
The robot distinguishes between the commands in methods (methods) and parameters (params) which serve to specify the methods.
Under the object mihome-vacuum.X.control.X_send_command
you can send your own commands to the robot.
The object structure must look as follows: method; [params], eg app_segment_clean;[18,20]
Under the object mihome-vacuum.X.control.X_get_response
, the response is entered by the robot after sending.
If parameters were queried, they appear here in the JSON format. If only one command was sent, the robot responds only with "0".
The following methods and parameters are supported:
method | params | Description |
---|---|---|
get_timer | Returns the set timerSetting the suction times BSp. 12 o'clock 30 in 5 days | |
set_timer | [["TIME_IN_MS",["30 12 * * 1,2,3,4,5",["start_clean",""]]]] |
Enable / disable timer |
upd_timer | ["1481997713308","on/off"] |
|
Rescues the times of the Do Not Disturb | ||
get_dnd_timer | Delete DND times | |
close_dnd_timer | DND Setting h, min, h, min | |
set_dnd_timer | [22,0,8,0] |
|
app_rc_start | Start Remote Control | |
app_rc_end | Finish Remote Control | |
app_rc_move | [{"seqnum":'0-1000',"velocity":VALUE1,"omega":VALUE2,"duration":VALUE3}] |
Move. Sequence number must be continuous, VALUE1 (speed) = -0.3-0.3, VALUE2 (rotation) = -3.1-3.1, VALUE3 (duration) |
app_segment_clean | [12,15] |
clean romm with Index 12 and 15 |
more methods and parameters you can find here (Link).
You can also send those custom commands from other adapters with sendTo
. Usage with method_id
and params
as defined above:
sendTo("mihome-vacuum.0", "sendCustomCommand",
{method: "method_id", params: [...] /* optional*/},
function (response) { /* do something with the result */}
);
The response
object has two properties: error
and (if there was no error) result
.
A couple of predefined commands can also be issued this way:
sendTo("mihome-vacuum.0",
commandName,
param,
function (response) { /* do something with the result */}
);
sendTo("mihome-vacuum.0",
commandName,
{param1: value1, param2: value2, ...},
function (response) { /* do something with the result */}
);
if only a single param is possible, you can send a string only otherwise you have to use an object with expected params, eg:
sendTo("mihome-vacuum.0",
"setFanSpeed",
"105",
function (response) { /* do something with the result */}
);
sendTo("mihome-vacuum.0",
"setFanSpeed",
{"fanSpeed" : 105},
function (response) { /* do something with the result */}
);
The supported commands are:
Description | commandName |
Required params | Remarks |
---|---|---|---|
Start the cleaning process | startVacuuming |
- none - | |
Stop the cleaning process | stopVacuuming |
- none - | |
Pause the cleaning process | pause |
- none - | |
Clear waiting jobs | clearQueue |
- none - | |
Clean a small area around the robot | cleanSpot |
- none - | |
Go back to the base | charge |
- none - | |
Say "Hi, I'm over here!" | findMe |
- none - | |
Check status of consumables (brush, etc.) | getConsumableStatus |
- none - | |
Reset status of consumables (brush, etc.) | resetConsumables |
consumable |
String: filter_work_time, filter_element_work_time, sensor_dirty_time, main_brush_work_time, side_brush_work_time |
Get a summary of all previous cleaning processes | getCleaningSummary |
- none - | |
Get a detailed summary of a previous cleaning process | getCleaningRecord |
recordId |
|
Get a map | getMap |
- none - | Unknown what to do with the result |
Get the current status of the robot | getStatus |
- none - | |
Retrieve the robot's serial number | getSerialNumber |
- none - | |
Get detailed device information | getDeviceDetails |
- none - | |
Retrieve the do not disturb timer | getDNDTimer |
- none - | |
Set a new do not disturb timer | setDNDTimer |
startHour , startMinute , endHour , endMinute |
|
Delete the do not disturb timer | deleteDNDTimer |
- none - | |
Retrieve the current fan speed | getFanSpeed |
- none - | |
Set a new fan speed | setFanSpeed |
fanSpeed |
fanSpeed is a number between 1 and 100 |
Retrieve the current waterbox mode | getWaterBoxMode |
- none - | |
Set a mop mode | setMopMode |
mopMode |
mopMode is a number between 300 and 303 |
Retrieve the current mop mode | getMopMode |
- none - | |
Set a waterbox mode | setWaterBoxMode |
waterBoxMode | {waterBoxMode:waterBoxMode ,waterBoxLevel:waterBoxLevel } |
waterBoxMode is a number between 200 and 204 or 207 -> then you have to provede also waterBoxLevel as number between 1 - 30 |
Start the remote control function | startRemoteControl |
- none - | |
Issue a move command for remote control | move |
velocity , angularVelocity , duration , sequenceNumber |
Sequence number must be sequentially, Duration is in ms |
End the remote control function | stopRemoteControl |
- none - | |
clean room/rooms | cleanRooms |
rooms |
rooms is a comma separated String with enum.rooms.XXX |
clean segment | cleanSegments |
rooms | {rooms:rooms ,waterBoxMode:waterBoxMode ,mopMode:mopMode ,fanSpeed:fanSpeed } |
rooms is a number or an Array with mapIndex or comma separated String with mapIndex |
clean zone | cleanZone |
coordinates | {coordinates:coordinates ,waterBoxMode:waterBoxMode ,mopMode:mopMode ,fanSpeed:fanSpeed ,repeat:iterations } |
coordinates is a String with coordinates and count, see zoneClean |
start Dust collecting | startDustCollect |
- none - | |
stop Dust collecting | stopDustCollect |
- none - | |
start Mop washing | startWashMop |
- none - | |
stop Mop washing | stopWashMop |
- none - |
- Occasional disconnections, however, this is not due to the adapter but mostly on its own networks
- Widget at the time without function
- (simatec) responsive design added
- (deher) update dependecies and linting
- (mcm1957) Adapter requires node.js 18 and js-controller >= 5 now
- (mcm1957) Dependencies have been updated
- (dirkhe) update dependecies
- (dirkhe) replace zlib with native zlib
- (Dirkhe) adapt stockConsumables to dreame
- (dirkhe) fix url #886
- (Dirkhe) update dependecies
- (Dirkhe) add Roborock S8 and P10
- (Dirkhe) rework consumable features
- (DemigodCode) inital version of dream support
- (Dirkhe) add Roborock S8 Ultra Pro
- (TA2k) fix too much map request to prevent map rate limit in the app
- (Dirkhe) fix waterBoxLevel
- (Dirkhe) fix overwriting of roomStates from global
- (Dirkhe) check also stockcommands in onMessage
- (Dirkhe) add feature waterbox level #755
- (Dirkhe) change type of unsupported features
- (Dirkhe) fix button/command loadRooms
- (Dirkhe) cleanmap.mapURL typo fixed
- (Dirkhe) fix loosing passwort in config
- (Dirkhe) move map Url to userspace instead of admin space #735
- (Dirkhe) change mapUrl to /mihome-vacuum.0.userfiles/actualMap.png
- (Dirkhe) add function setUnsupportedFeature; if token changed, all stored unsupported Features will be cleared
- (dirkhe) fix bug from 3.9.1 for supported repeat devices
- (Dirkhe) add step property to repeat DP
- (Dirkhe) add Queue Fallback mode for repeat
- (Dirkhe) remove wrong clearQueue button
- (Dirkhe) add Mop washing #679
- (Dirkhe) trigger pauseResume only, if correct state is given #623
- (Dirkhe) add multiple clean iterations (repeat) #690
- (Dirkhe) housekeeping
- (Dirkhe) fix behaviour of pauseResume #623
- (Dirkhe) fix typo from translation for battary_live (based on viomi id) #629
- (Dirkhe) fix crash, if cloud-roomID is empty #702
- (Dirkhe) Fix type for roomMopMode
- (Dirkhe) move parseErrors to debug level
- (Dirkhe) avoid new instanziierung on reconnect
- (Dirkhe) change logging for sendMessage to debug
- (Dirkhe) change logging from timeouts
- (Dirkhe) hide parts of token in log
- (Dirkhe) Bump canvas to 2.10.2
- (Dirkhe) disable map, if CANVAS not installed #681
- (Dirkhe) remove deprecated node 12.x Version for workflow
- (Dirkhe) fix missing stock command for mop_mode
- (Dirkhe) add mop mode also for cleanSegments and cleanZone
- (Dirkhe) add mop mode also for rooms
- (MeisterTR) map zooming amd show carpet
- (Dirkhe) accept custom commands with single paramter
- (Dirkhe) optional parameter waterboxMode and fanSpeed for cleanSegments and cleanZone
- (Dirkhe) fix crash on message send (#652)
- (Dirkhe) add mop mode (#670)
- (Dirkhe) adapt fan_power for S7 Ultra(#677)
- (Dirkhe) add dust collecting
- (Dirkhe) add Roborock S6 Pure model
- (Dirkhe) add/extend some Hints in readme
- (Dirkhe) add additional log info for cleanRooms
- (Dirkhe) fix error for wrong map-dp
- (Apollon77) Update dependencies to allow better automatic rebuild
- (Dirkhe) add missed Vacuum states
- (Dirkhe) add dock state Waste water tank full
- (Apollon77) Fix several potential crash cases reported by Sentry
- (Dirkhe) fix spotcleaning
- (Dirkhe) fixed some errors
- (lasthead0) fix cyrillic issue RC4 lib#
- (Dirkhe) fixed some errors
- (Dirkhe) add RC4
- (MeisterTR) fix IOBROKER-MIHOME-VACUUM-Z
- (MeisterTR) fix some errors
- (MeisterTR) fix no rooms for S5
- (MeisterTR) fix IOBROKER-MIHOME-VACUUM-4 DB closed
- (MeisterTR) fix connection error
- (bluefox) the communication is corrected
- (bluefox) Added roles to be detected by type-detector
- (Apollon77) Adjust several crash cases (IOBROKER-MIHOME-VACUUM-K, IOBROKER-MIHOME-VACUUM-J, IOBROKER-MIHOME-VACUUM-F, IOBROKER-MIHOME-VACUUM-7, IOBROKER-MIHOME-VACUUM-A, IOBROKER-MIHOME-VACUUM-4, IOBROKER-MIHOME-VACUUM-G, IOBROKER-MIHOME-VACUUM-C, IOBROKER-MIHOME-VACUUM-B, IOBROKER-MIHOME-VACUUM-Q, IOBROKER-MIHOME-VACUUM-M)
- (MeisterTR) release candidate
- (MeisterTR) get consumable after reset
- error fixed
- add sentry
- minimize Disk write
- minimized Messages
- changed warn Messages to debug
- extend Debuglog to find error for e2 vacuum
- added getStates when map is changed
- try to fix the map error
- Map64 changed. now without img tags
- add Multimap support (get rooms and map when map is changed)
- select Multimaps
- fix error with zone coordinates
- add WiFi
- fix connection Problems
- fix Valetudo map
- add Mop state
- fix some objects
- Full rewrite
- Fix map bug with multiple vacuums
- fix performance Problems
- better connection to vacuum
- fix bug in ReloadMap button
- Show Goto and Zone States ti find places
- and many more...
- added S7 Support
- bugfixes for S5 Max and others
- (dirkhe) add config for send Pause Before Home
- (dirkhe) room DP are not deleted, on map change
- (MeisterTR) add test for Viomi and Dreame Api
- (bluefox) Refactoring
- (bluefox) Support of compact mode added
- try to start the cleaning 3 times, if robot not answers and some fixes
- (dirkhe) add state info for room channels and change queue info from number to JSON
- (dirkhe) decreased communication with robot
- (dirkhe) add Resuming after pause for rooms
- (MeisterTR) add rooms for s50 with map (cloud or Valetudo needed)
- (MeisterTR) add cloud login to get token
- (MeisterTR) add cloud Map
- (MeisterTR) add new and old Map format
- (MeisterTR) rebuild config page
- send Ping only if not connected, otherwise get_status
- set button states to true, if clicked
- move timer manager and room manager to own libs
- (MeiserTR) add valetudo map support for gen3 and gen2 2XXX
- (dirkhe) added zone as room handling
- (dirkhe) timer could room channels directly
- (dirkhe) added room handling
- (dirkhe) added Timer
- (dirkhe) changed feature handling
- (JoJ123) Added fan speed for MOP (S50+).
- (BuZZy1337) Added description for Status 16 and 17 (goTo and zone cleaning).
- (BuZZy1337) Added setting for automatic resume of paused zone cleaning.
- (BuZZy1337) Added possibility to resume a paused zone clean (State: mihome-vacuum.X.control.resumeZoneClean)
- (BuZZy1337) fixed zoneCleanup state not working (vacuum was only leaving the dock, saying "Finished ZoneCleanup", and returned immediately back to the dock)
- (BuZZy1337) fixed detection of new Firmware / Second generation Vacuum
- (MeisterTR) error caught , added states for new fw
- (mswiege) Finished the widget
- (MeisterTR) ready for admin3
- (MeisterTR) support SpotClean and voice level (v1)
- (MeisterTR) support second generation (S50)
- (MeisterTR) Speed up data requests
- (MeisterTR) use 96 char token from Ios Backup
- (MeisterTR) faster connection on first use
- (MeisterTR) fix communication error without i-net
- (AlCalzone) add selection of predefined power levels
- (MeisterTR) compare system time and Robot time (fix no connection if system time is different)
- (MeisterTR) update values if robot start by cloud
- (MeisterTR) add option for crate switch for Alexa control
- (MeisterTR) add states, features, fix communication errors
- (MeisterTR) fix no communication after softwareupdate(Vers. 3.3.9)
- (MeisterTR) fix setting the fan power
- (bluefox) catch error if port is occupied
- (MeisterTR) add more states
- (steinwedel) implement better decoding of packets
- (bluefox) initial commit
The MIT License (MIT)
Copyright (c) 2023-2024 iobroker community developers [email protected]
Copyright (c) 2017-2023 bluefox [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.