xiaomi vacuum with zone and reps (#8047)

* xiaomi vacuum with zone and reps

* xiaomi vacuum with zone and reps

* xiaomi vacuum with zone and reps

* xiaomi vacuum with zone and reps

* xiaomi vacuum with zone and reps

* add reps template

* rytilahti tips

* rytilahti tips

* automation editor fix

* Revert "automation editor fix"

This reverts commit 58bb3ad6a77c90b2fe4b080c1e36a7db18897224.

* rytilahti tips

* data_template schema

* conflict resolve

* conflict

* fix merge error

* ✏️ Tweak
This commit is contained in:
Marco Gazzola 2019-02-25 21:26:42 +01:00 committed by Franck Nijhof
parent ca223dfc28
commit 747ac6e09e

View File

@ -25,6 +25,7 @@ Currently supported services are:
- `clean_spot` - `clean_spot`
- `set_fan_speed` - `set_fan_speed`
- remote control of your robot. - remote control of your robot.
- `xiaomi_clean_zone`
## {% linkable_title Configuration %} ## {% linkable_title Configuration %}
@ -64,6 +65,7 @@ In addition to all of the services provided by the `vacuum` component (`start`,
- `xiaomi_remote_control_stop` - `xiaomi_remote_control_stop`
- `xiaomi_remote_control_move` - `xiaomi_remote_control_move`
- `xiaomi_remote_control_move_step` - `xiaomi_remote_control_move_step`
- `xiaomi_clean_zone`
### {% linkable_title Service `vacuum.xiaomi_remote_control_start` %} ### {% linkable_title Service `vacuum.xiaomi_remote_control_start` %}
@ -103,6 +105,73 @@ Enter remote control mode, make one move, stop, and exit remote control mode.
| `rotation` | no | Rotation: between -179 degrees and 179 degrees | | `rotation` | no | Rotation: between -179 degrees and 179 degrees |
| `duration` | no | The number of milliseconds that the robot should move for | | `duration` | no | The number of milliseconds that the robot should move for |
### {% linkable_title Service `vacuum.xiaomi_clean_zone` %}
Start the cleaning operation in the areas selected for the number of repeats indicated.
| Service data attribute | Optional | Description |
|---------------------------|----------|-------------------------------------------------------|
| `entity_id` | yes | Only act on specific robot; default targets all |
| `zone` | no | List of zones. Each zone is an array of 4 integer value. Example: [[23510,25311,25110,26361]] |
| `repeats` | no | Number of cleaning repeats for each zone between 1 and 3. |
Example of `vacuum.xiaomi_clean_zone` use:
Inline array:
```yaml
automation:
- alias: Test vacuum zone3
trigger:
- event: start
platform: homeassistant
condition: []
action:
- service: vacuum.xiaomi_clean_zone
data_template:
entity_id: vacuum.xiaomi_vacuum
repeats_template: '{{states.input_number.vacuum_passes.state|int}}'
zone: [[30914,26007,35514,28807], [20232,22496,26032,26496]]
```
Array with inline zone:
```yaml
automation:
- alias: Test vacuum zone3
trigger:
- event: start
platform: homeassistant
condition: []
action:
- service: vacuum.xiaomi_clean_zone
data_template:
entity_id: vacuum.xiaomi_vacuum
repeats_template: '{{states.input_number.vacuum_passes.state|int}}'
zone:
- [30914,26007,35514,28807]
- [20232,22496,26032,26496]
```
Array mode:
```yaml
automation:
- alias: Test vacuum zone3
trigger:
- event: start
platform: homeassistant
condition: []
action:
- service: vacuum.xiaomi_clean_zone
data:
entity_id: vacuum.xiaomi_vacuum
repeats: 1
zone:
- - 30914
- 26007
- 35514
- 28807
- - 20232
- 22496
- 26032
- 26496
```
## {% linkable_title Attributes %} ## {% linkable_title Attributes %}
In addition to [all of the attributes provided by the `vacuum` component](/components/vacuum/#attributes), In addition to [all of the attributes provided by the `vacuum` component](/components/vacuum/#attributes),
@ -293,22 +362,19 @@ Software Required:
- [Mi-Home version 5.0.30](https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-0-30-release/) - [Mi-Home version 5.0.30](https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-0-30-release/)
- [Android Backup Extractor](https://sourceforge.net/projects/adbextractor/) - [Android Backup Extractor](https://sourceforge.net/projects/adbextractor/)
- [SQLite Browser](https://sqlitebrowser.org/) - [SQLite Browser](https://sqlitebrowser.org/)
1. Install an old Version of MiHome (e.g. Mi-Home version 5.0.30) on your Android-Device
Steps to take: 2. Open MiHome, log-in and add your devices
3. Enable USB-Debugging on your Android
1. Install an old Version of MiHome (e.g. Mi-Home version 5.0.30) on your Android-Device. 4. Create a backup from your MiHome App, by using adb
2. Open MiHome, log-in and add your devices.
3. Enable USB-Debugging on your Android.
4. Create a backup from your MiHome App, by using adb:
```bash ```bash
adb backup com.xiaomi.smarthome adb backup com.xiaomi.smarthome
``` ```
Now the backup App opens on you Android-Device. You don't need to set a password, just click save. Now the backup App opens on you Android-Device. You don't need to set a password, just click save.
5. Extract the backup-file with android-backup-extractor: 5. Extract the backup-file with android-backup-extractor
```bash ```bash
java -jar abe.jar unpack backup.ab backup.tar java -jar abe.jar unpack backup.ab backup.tar
``` ```
After that, extract the file with WinRAR, 7-Zip (or similar). After that, you kann open the file with WinRaR or what ever you like.
6. Go to `\apps\com.xiaomi.smarthome\db`. 6. Go to \apps\com.xiaomi.smarthome\db
7. Open `miio2.db` with the SQLite Browser. 7. Open miio2.db with SQLite Browser
8. You can find your device tokens in `devicerecord` table. 8. You can find your device tokens in "devicerecord" table