From 4618b759a93237faf0dc1c6309d6c958fd84e0bf Mon Sep 17 00:00:00 2001 From: Jonas Thuresson Date: Tue, 23 Jun 2020 23:32:39 +0200 Subject: [PATCH] Xiaomii miio vaccum clean segment service (#13759) Co-authored-by: Franck Nijhof --- .../_integrations/vacuum.xiaomi_miio.markdown | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/source/_integrations/vacuum.xiaomi_miio.markdown b/source/_integrations/vacuum.xiaomi_miio.markdown index 8c328afdbac..9dbaffdc2a4 100644 --- a/source/_integrations/vacuum.xiaomi_miio.markdown +++ b/source/_integrations/vacuum.xiaomi_miio.markdown @@ -190,6 +190,47 @@ Go the specified coordinates | `x_coord` | no | X-coordinate, integer value. The dock is located at x-coordinate 25500. | | `y_coord` | no | Y-coordinate, integer value. The dock is located at y-coordinate 25500. | +### Service `xiaomi_miio.vacuum_clean_segment` + +Clean the specified segment/room. A room is identified by a number. Instructions on how to find the valid room numbers and determine what rooms they map to, read the section [Retrieving room numbers](#retrieving-room-numbers). + +| Service data attribute | Optional | Description | +|---------------------------|----------|-------------------------------------------------------| +| `entity_id` | no | Only act on a specific robot | +| `segments` | no | List of segment numbers or one single segment number. | + +Example of `xiaomi_miio.vacuum_clean_segment` use: + +Multiple segments: +```yaml +automation: + - alias: Vaccum kitchen and living room + trigger: + - event: start + platform: homeassistant + condition: [] + action: + - service: xiaomi_miio.vacuum_clean_segment + data: + entity_id: vacuum.xiaomi_vacuum + segments: [1,2] +``` + +Single segment: +```yaml +automation: + - alias: Vacuum kitchen + trigger: + - event: start + platform: homeassistant + condition: [] + action: + - service: xiaomi_miio.vacuum_clean_segment + data: + entity_id: vacuum.xiaomi_vacuum + segments: 1 +``` + ## Attributes In addition to [all of the attributes provided by the `vacuum` component](/integrations/vacuum/#attributes), @@ -364,15 +405,7 @@ vacuum_kitchen: params: [18] ``` -Where params specify room numbers, for multiple rooms, params can be specified like `[17,18]`. - -Valid room numbers can be retrieved using miio command-line tool. It will only give room numbers and not the room names. To get the room names, one can just test the app_segment_clean command and see which room it cleans. - -Note: if you don't have access to the miio command-line tool, you can try the app_segment_clean command starting from number 16 as this number seems to be the first room. - -```bash -miio protocol call get_room_mapping -``` +Where params specify room numbers, for multiple rooms, params can be specified like `[17,18]`. Instructions on how to find the valid room numbers and determine what rooms they map to, read the section [Retrieving room numbers](#retrieving-room-numbers). ## Example on how to reset maintenance hours (brushes, filter, sensors) @@ -425,3 +458,15 @@ vacuum_kitchen: command: app_zoned_clean params: [[23084,26282,27628,29727,1]] ``` + +## Retrieving Room numbers + +Valid room numbers can be retrieved using miio command-line tool: + +```bash +miio protocol call get_room_mapping +``` + +It will only give room numbers and not the room names. To mat the room numbers to your actual rooms, one can just test the clean_segment service with a number and see which room it cleans. The Xiaomi Home App will highlight the room after issuing the request, which makes the process rather convenient. + +It seems to be the case that Numbers 1..15 are used to number the intitial segmentation done by the vacuum cleaner itself. Numbers 16 and upwards numbers rooms from the users manual editing.