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

Feature request: Support of Xiaomi Miot vacuum platform #251

Closed
fewdji opened this issue Dec 8, 2021 · 70 comments
Closed

Feature request: Support of Xiaomi Miot vacuum platform #251

fewdji opened this issue Dec 8, 2021 · 70 comments
Assignees
Labels
enhancement New feature or request new platform

Comments

@fewdji
Copy link

fewdji commented Dec 8, 2021

Description

Please add support of al-one/hass-xiaomi-miot platform.

Solution

Example of calling service for zone cleaning:

vacuum_carpet:
  sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.dreame_d9
        siid: 4
        aiid: 1
        params:
          - piid: 1
            value: 19
          - piid: 10
            value: '{"areas":[[-1300,-2150,-20,-390,3,1,1]]}'
        force_params: true

...and room:

vacuum_room:
  sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.dreame_d9
        siid: 4
        aiid: 1
        params:
          - piid: 1
            value: 18
          - piid: 10
            value: '{"selects":[[4,1,3,3,1]]}'
        force_params: true

Alternatives

No response

Context

No response

@fewdji fewdji added the enhancement New feature or request label Dec 8, 2021
@PiotrMachowski
Copy link
Owner

@fewdji can you provide a more detailed description for these services? (including stuff passed in params)

@fewdji
Copy link
Author

fewdji commented Dec 8, 2021

siid and aiid are ids of actions.
piid - id of property.

{"areas":[[-1300,-2150,-20,-390,3,1,1]]}
First four - coordinates, number of repetitions, power level, water level

{"selects":[[4,1,3,3,1]]}
Room id, number of repetitions, power level, water level, ???

@PiotrMachowski
Copy link
Owner

PiotrMachowski commented Dec 8, 2021

I'm not sure if I understand everything correctly, can describe lines with ????

vacuum_carpet:
  sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.dreame_d9
        siid: 4         # vacuum-extend
        aiid: 1         # start-clean
        params:
          - piid: 1     # ??? (is it work-mode? if so, in documentation it is marked as readonly)
            value: 19   # ??? 
          - piid: 10    # clean-extend-data
            value: '{"areas":[[-1300,-2150,-20,-390,3,1,1]]}'
        force_params: true
vacuum_room:
  sequence:
    - service: xiaomi_miot.call_action
      data:
        entity_id: vacuum.dreame_d9
        siid: 4         # vacuum-extend
        aiid: 1         # start-clean
        params:
          - piid: 1     # ??? (is it work-mode? if so, in documentation it is marked as readonly)
            value: 18   # ??? 
          - piid: 10    # clean-extend-data
            value: '{"selects":[[4,1,3,3,1]]}'
        force_params: true

It seems that every device has its own specific values for siid/aiid/piid + own formats for values, am I right?

@fewdji
Copy link
Author

fewdji commented Dec 8, 2021

        params:
          - piid: 1     # work mode
            value: 19   # cleaning by room
        params:
          - piid: 1     # work mode
            value: 18   # cleaning by zones

You're right every model has own values for siid/aiid/piid.
Maybe the best way is to implement 'Custom' platform which allows to call custom services/scripts with params. Something like this:

service: xiaomi_miot.call_action
    data:
      entity_id: vacuum.dreame_d9
      siid: 4
      aiid: 1
      params:
        - piid: 1
          value: 19
        - piid: 10
          value: '{"areas":[[%coordinates%,%repeats%,1,1]]}' # just like example
      force_params: true

@PiotrMachowski
Copy link
Owner

Ok, I don't really want to add a separate platform for each vacuum from this integration.

Custom platform already exists: you don't provide vacuum_platform and provide service_call_schema for every entry in map_mode list, just like here: example.

The problem is that currently it is not possible to substitute a part of a value, just whole value, so it can't be used to describe xiaomi_miot.call_action service. I will try to add it 👍

@fewdji
Copy link
Author

fewdji commented Dec 8, 2021

Agree with the first sentence.
Adding part of a value would be great!
Thank you!

@PiotrMachowski
Copy link
Owner

PiotrMachowski commented Jan 5, 2022

Template processor has been improved in v2.0.9. Now it is possible to use xiaomi_miot.call_action service:

  • Vacuum zone

    - template: vacuum_clean_zone
      max_selections: 1
      repeats_type: EXTERNAL
      max_repeats: 5
      service_call_schema:
        service: xiaomi_miot.call_action
        service_data:
          entity_id: '[[entity_id]]'
          siid: 4
          aiid: 1
          params:
            - piid: 1
              value: 19
            - piid: 10
              value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
          force_params: true
  • Vacuum room

    - template: vacuum_clean_segment
      max_selections: 1
      repeats_type: EXTERNAL
      max_repeats: 5
      service_call_schema:
        service: xiaomi_miot.call_action
        service_data:
          entity_id: '[[entity_id]]'
          siid: 4
          aiid: 1
          params:
            - piid: 1
              value: 18
            - piid: 10
              value: '{"selects":[[[[selection_unwrapped]],[[repeats]],3,3,1]]}'
          force_params: true
      predefined_selections:
        ...

@ffesius
Copy link

ffesius commented Jan 12, 2022

Hello. Can't get the roidmi eve vacuum cleaner to work properly. It doesn't have siid vacuum-extend. https://home.miot-spec.com/spec/roidmi.vacuum.v60 I have already tried the commands, but I cannot start cleaning the zone.

@muehlt
Copy link

muehlt commented Apr 2, 2022

siid and aiid are ids of actions. piid - id of property.

{"areas":[[-1300,-2150,-20,-390,3,1,1]]} First four - coordinates, number of repetitions, power level, water level

{"selects":[[4,1,3,3,1]]} Room id, number of repetitions, power level, water level, ???

How did you find out about the exact values needed for clean-extend-data and the work mode? I am currently working with a Dreame W10 (dreame.vacuum.p2027) and our devices seem to have a very similar set of siids, aiids and piids but I cannot get it to work with the above configuration. I also tried it with the start-room-sweep action that is not present for your robot but always get the same error code (-704220025) that indicates a wrong parameter.
Thanks!

Edit: I checked again - if i provide both

params:
    - piid: 1
      value: 19
    - piid: 10
      value: '{"selects":[[1,1,2,2,1]]}'

i get miot_action_error: -704220025 The number of action parameters does not match
and if i only provide

params:
    - piid: 10
      value: '{"selects":[[1,1,2,2,1]]}'

i get miot_action_error: -704220035 Action parameter error

@fewdji
Copy link
Author

fewdji commented Apr 2, 2022

How did you find out about the exact values needed for clean-extend-data and the work mode?

I used modificated version of MiHome (by vevs). It allows to log all command which sends to the vacuum.
Start necessary action from app and then check it in logs

@muehlt
Copy link

muehlt commented Apr 2, 2022

I used modificated version of MiHome (by vevs). It allows to log all command which sends to the vacuum.

Thanks!

@muehlt
Copy link

muehlt commented Apr 2, 2022

Found the issue. If someone has the same problem: in this scenario (checked for rooms) @fewdji's example works 100% for the W10, the devices are really similar. My problem was that I had miot_cloud_action enabled because I thought it fixed an issue earlier, not sure why all actions except the room one worked though.

@inviz-ize
Copy link

inviz-ize commented Apr 14, 2022

Template processor has been improved in v2.0.9. Now it is possible to use xiaomi_miot.call_action service:

  • Vacuum zone
    - template: vacuum_clean_zone
      max_selections: 1
      repeats_type: EXTERNAL
      max_repeats: 5
      service_call_schema:
        service: xiaomi_miot.call_action
        service_data:
          entity_id: '[[entity_id]]'
          siid: 4
          aiid: 1
          params:
            - piid: 1
              value: 19
            - piid: 10
              value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
          force_params: true
  • Vacuum room
    - template: vacuum_clean_segment
      max_selections: 1
      repeats_type: EXTERNAL
      max_repeats: 5
      service_call_schema:
        service: xiaomi_miot.call_action
        service_data:
          entity_id: '[[entity_id]]'
          siid: 4
          aiid: 1
          params:
            - piid: 1
              value: 18
            - piid: 10
              value: '{"selects":[[[[selection_unwrapped]],[[repeats]],3,3,1]]}'
          force_params: true
      predefined_selections:
        ...

And what can we do in case of multiselected rooms or areas?
For rooms we need such string (array with parameters for each room):
value: '{"selects":[[5,1,1,3,1],[1,1,1,3,1],[3,1,1,3,1]]}'

@PiotrMachowski

This comment was marked as outdated.

@inviz-ize
Copy link

Great! Thanks a lot!

@PiotrMachowski
Copy link
Owner

@inviz-ize please confirm if it works

@inviz-ize
Copy link

inviz-ize commented Apr 14, 2022

Not yet( Trying to understand why. Seems that ninja template don't work
My debug:
Screenshot 2022-04-14 at 13 40 08
Script was a little bit modified because for my model (dreame.mb1808) we don't have repeats, second number is reservation to additional room number and we also have water level.

@PiotrMachowski
Copy link
Owner

PiotrMachowski commented Apr 14, 2022

Jinja templates are resolved later by HA core, not by the card. You can paste this output to dev tools template tester to check out if everything is correct.

@inviz-ize
Copy link

Checked it with dev tools.

{
  "domain": "xiaomi_miot",
  "service": "call_action",
  "serviceData": {
    "entity_id": "vacuum.ksiushka",
    "siid": 18,
    "aiid": 1,
    "params": [
      {
        "piid": 1,
        "value": 18
      },
      {
        "piid": 21,
        "value": "{"selects":[[6,1,3,3,1],[3,1,3,3,1]]}"
      }
    ],
    "force_params": true
  }
}

Seems that all should be ok. I'm receiving success message from the card, but still my vacuum doing nothing. Will try to debug deeper

@PiotrMachowski
Copy link
Owner

Ok, can you try to use following data in manual service call from dev tools?

service: xiaomi_miot.call_action
data: {
    "entity_id": "vacuum.ksiushka",
    "siid": 18,
    "aiid": 1,
    "params": [
      {
        "piid": 1,
        "value": 18
      },
      {
        "piid": 21,
        "value": '{"selects":[[6,1,3,3,1],[3,1,3,3,1]]}'
      }
    ],
    "force_params": true
  }

@inviz-ize
Copy link

Checked this. Works fine.

@PiotrMachowski
Copy link
Owner

Hmmm, is there anything in logs? Maybe resolving templates doesn't work for all services...

@inviz-ize
Copy link

it seems that you are right :(
log:
image

@PiotrMachowski
Copy link
Owner

:( it worked here

Can you try following one? It should create a notification instead

- template: vacuum_clean_segment
  max_selections: 5
  repeats_type: EXTERNAL
  max_repeats: 5
  service_call_schema:
    service: persistent_notification.create
    service_data:
      title: 'Command to [[entity_id]]'
      message: '{"selects":[{% for s in [[selection]] %}[{{s}},[[repeats]],1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}'
  predefined_selections:
    ...

@irarkh
Copy link

irarkh commented Jun 10, 2022

Viomi V5 pro

Although I found viomi v5 pro command and ids but I am not familiar with coding to match the other models cods. would appreciate to give me an example.

it is how I added:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.v38_cloud_146784
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
map_modes:
  - template: vacuum_goto
  - template: vacuum_clean_zone
     max_selections: 1
     repeats_type: EXTERNAL
     max_repeats: 5
     service_call_schema:
       service: xiaomi_miot_raw.call_action
       service_data:
         entity_id: vacuum.v38_cloud_146784
         siid: 18                          # vacuum-extend
         aiid: 1                           # start-clean
         params:
           - piid: 1                       # work mode
             value: 19                    
           - piid: 21                      # clean-info
             value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
         force_params: true
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 1
        label:
          text: Room 1

@PiotrMachowski
Copy link
Owner

Here you have yaml with fixed indentaion:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.v38_cloud_146784
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
map_modes:
  - template: vacuum_goto
  - template: vacuum_clean_zone
    max_selections: 1
    repeats_type: EXTERNAL
    max_repeats: 5
    service_call_schema:
      service: xiaomi_miot_raw.call_action
      service_data:
        entity_id: vacuum.v38_cloud_146784
        siid: 18                          # vacuum-extend
        aiid: 1                           # start-clean
        params:
          - piid: 1                       # work mode
            value: 19                    
          - piid: 21                      # clean-info
            value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
        force_params: true
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 1
        label:
          text: Room 1

@Xander124
Copy link

I have a problem with the configuration of the Xiaomi Mijia 1C (dreame.vacuum.mc1808). Camera Map Extractor downloaded the map. I can see the vacuum cleaner on the tab, but when turned on, it does not draw a path in live view. The vacuum cleaner disappears. Only after entering the Xaiomi Home application on the smartphone does it refresh the map, but this is not always the case. The status of the camera.xiaomi_cloud_map_extractor entity is still idle even when I turn on the vacuum cleaner.
Camera code:

camera:
- platform: xiaomi_cloud_map_extractor
  host: !secret vacuum_ip
  token: !secret vacuum_token
  username: !secret xiaomi_user
  password: !secret xiaomi_pass
  country: de
  colors:
    color_map_inside: [32, 115, 185]
    color_map_outside: [19, 87, 148]
    color_map_wall: [255, 255, 255]
    color_map_wall_v2: [93, 109, 126]
    color_grey_wall: [93, 109, 126]
    color_ignored_obstacle: [0, 0, 0, 127]
    color_ignored_obstacle_with_photo: [0, 0, 0, 127]
    color_obstacle: [0, 0, 0, 127]
    color_obstacle_with_photo: [0, 0, 0, 127]
    color_path: [0, 0, 0]
    color_goto_path: [0, 0, 0]
    color_predicted_path: [255, 255, 0, 0]
    color_cleaned_area: [127, 127, 127, 127]
    color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
    color_zones_outline: [0xAD, 0xD8, 0xFF]
    color_virtual_walls: [255, 0, 0]
    color_new_discovered_area: [64, 64, 64]
    color_no_go_zones: [255, 33, 55, 127]
    color_no_go_zones_outline: [255, 0, 0]
    color_no_mop_zones: [163, 130, 211, 127]
    color_no_mop_zones_outline: [163, 130, 211]
    color_charger: [0x66, 0xfe, 0xda, 0x7f]
    color_robo: [211, 238, 106]
    color_room_names: [255, 255, 255]
    color_unknown: [0, 0, 0]
    color_scan: [0xDF, 0xDF, 0xDF]
  room_colors:
    1: [240, 178, 122]
    2: [88, 214, 141]
    3: [217, 136, 128]
    4: [52, 152, 219]
  draw: ["all"]
  #      - charger
  #      - cleaned_area
  #      - goto_path
  #      - ignored_obstacles
  #      - ignored_obstacles_with_photo
  #      - no_go_zones
  #      - no_mopping_zones
  #      - obstacles
  #      - obstacles_with_photo
  #      - path
  #      - predicted_path
  #      - room_names
  #      - vacuum_position
  #      - virtual_walls
  #      - zones
  attributes:
    - calibration_points
    - charger
    #      - cleaned_rooms
    - country
    #      - goto
    #      - goto_path
    #      - goto_predicted_path
    - image
    - is_empty
    - map_name
    - no_go_areas
    - no_mopping_areas
    - obstacles
    #      - ignored_obstacles
    - obstacles_with_photo
    #      - ignored_obstacles_with_photo
    - path
    - room_numbers
    - rooms
    - vacuum_position
  #      - vacuum_room
  #      - vacuum_room_name
  #      - walls
  #      - zones
  scan_interval:
    seconds: 10
  auto_update: true
  store_map_raw: false
  store_map_image: true
  store_map_path: "/tmp"
  force_api: dreame

lovelace-xiaomi-vacuum-map-card:

type: custom:xiaomi-vacuum-map-card
map_source:
camera: camera.xiaomi_cloud_map_extractor
calibration_source:
camera: true
entity: vacuum.dreame_mc1808_659b_robot_cleaner
vacuum_platform: send_command
map_locked: true
tiles: null
map_modes:
- template: vacuum_clean_zone
  max_selections: 1
  repeats_type: EXTERNAL
  max_repeats: 5
  service_call_schema:
    service: xiaomi_miot.call_action
    service_data:
      entity_id: vacuum.dreame_mc1808_659b_robot_cleaner
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 19
        - piid: 21
          value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
      force_params: true
- template: vacuum_goto
- template: vacuum_clean_segment
  max_selections: 4
  repeats_type: EXTERNAL
  max_repeats: 3
  service_call_schema:
    service: xiaomi_miot.call_action
    service_data:
      entity_id: vacuum.dreame_mc1808_659b_robot_cleaner
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - piid: 6
          value: 0
        - piid: 21
          value: '{"selects":[[[[selection_unwrapped]],[[repeats]],3,3,1]]}'
      force_params: true
  predefined_selections:
    - id: 1
      outline:
        - - -1917
          - 3637
        - - -1917
          - 5464
        - - -706
          - 5464
        - - -706
          - 3637
      label:
        text: Łazienka
        x: -1350
        'y': 4634
        offset_y: 35
      icon:
        name: mdi:shower
        x: -1350
        'y': 4634
    - id: 2
      outline:
        - - 323
          - 2953
        - - 323
          - 5834
        - - 2823
          - 5834
        - - 2823
          - 2953
      label:
        text: Pokój
        x: 1500
        'y': 4334
        offset_y: 35
      icon:
        name: mdi:chair-rolling
        x: 1500
        'y': 4334
    - id: 3
      outline:
        - - -4035
          - 3614
        - - -4035
          - 5344
        - - -2915
          - 5344
        - - -2915
          - 3614
        - - 452
          - 3794
        - - 452
          - -1465
        - - -3897
          - -1465
        - - -3897
          - 3794
      label:
        text: Salon
        x: -1650
        'y': 200
        offset_y: 35
      icon:
        name: mdi:sofa
        x: -1650
        'y': 200
    - id: 4
      outline:
        - - 412
          - -770
        - - 412
          - 2680
        - - 3103
          - 2680
        - - 3103
          - -770
      label:
        text: Sypialnia
        x: 1400
        'y': 2050
        offset_y: 35
      icon:
        name: mdi:bed-king-outline
        x: 1400
        'y': 2050

@auanasgheps
Copy link

I can see the vacuum cleaner on the tab, but when turned on, it does not draw a path in live view.

@Xander124 it's a kown issue, see PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor#299

@l3ztum
Copy link

l3ztum commented Jul 28, 2022

I will not add native support for Xiaomi Miot because it's not possible (as said above). I can add support for jinja templates

are jinja templates already supported? @PiotrMachowski

@PiotrMachowski
Copy link
Owner

@l3ztum they will be soon #447

@gachola
Copy link

gachola commented Jul 29, 2022

outline:
        - - 323
          - 2953
        - - 323
          - 5834
        - - 2823
          - 5834
        - - 2823
          - 2953

Hi
can you please tell me how did you get outline parameters for each room? I have 1c vacuum too

@PiotrMachowski
Copy link
Owner

@lokaelmo #318

@gachola
Copy link

gachola commented Jul 29, 2022

I did exactly that, path isn't supported in my vacuum so I switched to default but still the path doesn't show in the card
any tips, please

@Xander124
Copy link

Xander124 commented Jul 29, 2022 via email

@gachola
Copy link

gachola commented Jul 29, 2022

thanks for replying, I can't see the attachment, where can I find the orange start button

@PiotrMachowski
Copy link
Owner

@lokaelmo colors depend on selected theme. It is a "play" with a small icon of currently selected mode.

Instructions provided by @Xander124 do not match your question. You have to draw a path, not zone. If you have troubles achieving it in current version of the card you can wait a few days, there's a big release coming, it will make everything easier.

@gachola
Copy link

gachola commented Jul 29, 2022

ok, thanks a lot

@ShadowJonathan
Copy link

Does someone here have a template for the z10 pro?

@bedgerotto
Copy link

I saw jinja rendering is out since #447 but I'm still getting the following error log on HA:

Mijia 1C(dreame.vacuum.mc1808): Call miot action {'did': 'action-18-1', 'siid': 18, 'aiid': 1, 'in': [{'piid': 1, 'value': 18}, {'piid': 21, 'value': '{"areas":[{% for s in ["5","2","1"] %}[{{s}},1,1,3,1]{% if not loop.last %},{% endif %}{% endfor %}]}'}]} failed: Unable to recover failed command

This is what my configuration looks like:

- template: vacuum_clean_segment
  max_selections: 8
  repeats_type: EXTERNAL
  max_repeats: 3
  service_call_schema:
    service: xiaomi_miot.call_action
    service_data:
      entity_id: '[[entity_id]]'
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - piid: 21
          value: {"selects":[{% for s in [[selection]] %}[{{s}},1,1,3,1]{% if not loop.last %},{% endif %}{% endfor %}]}
      force_params: true

Could anybody make it work with the jinja template?

@PiotrMachowski
Copy link
Owner

@bedgerotto

- template: vacuum_clean_segment
  max_selections: 8
  repeats_type: EXTERNAL
  max_repeats: 3
  service_call_schema:
    evaluate_data_as_template: true
    service: xiaomi_miot.call_action
    service_data:
      entity_id: '[[entity_id]]'
      siid: 18
      aiid: 1
      params:
        - piid: 1
          value: 18
        - piid: 21
          value: {"selects":[{% for s in ('[[selection]]'|from_json) %}[{{s}},1,1,3,1]{% if not loop.last %},{% endif %}{% endfor %}]}
      force_params: true

@bedgerotto
Copy link

Thank you very much @PiotrMachowski. It worked! 🎉

@Zipp0KMS
Copy link

Hey. Is it possible to use the GoTo action with xiaomi miot?

@cosmos1978
Copy link

cosmos1978 commented Apr 15, 2023

I think I found a solution to change the scan interval when the device is docked/not docked.

If you set the default scan interval to 14400 seconds ( 4 hours ) in the configuration.yaml file and ten use the following 2 automations.

alias: update xiaomi map extractor
description: ""
trigger:
  - platform: time_pattern
    seconds: "15"
condition: []
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: camera.xiaomi_cloud_map_extractor
initial_state: "off"
mode: restart


alias: start/stop xiaomi fast scan interval
description: ""
trigger:
  - platform: state
    entity_id:
      - vacuum.roborock_s6
condition: []
action:
  - if:
      - condition: state
        entity_id: vacuum.roborock_s6
        state: docked
    then:
      - service: automation.turn_off
        data: {}
        target:
          entity_id: automation.update_xiaomi_map_extractor
    else:
      - service: automation.turn_on
        data: {}
        target:
          entity_id: automation.update_xiaomi_map_extractor
mode: single

EDIT: Had to do a small change in the second automations. I tested the automations and ot works for me.
Now lets wait some time to see if it fixes the issues we all see.

@TomasCorral
Copy link

Was anyne able to integrate Xiaomi S12?

@FilipeOS
Copy link

FilipeOS commented Jan 1, 2024

I have the room cleaning and zone cleaning not found issue in roborock s5

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.roborock_s5_0
calibration_source:
  camera: true
entity: vacuum.roborock_s5_af4f_robot_cleaner
vacuum_platform: al-one/hass-xiaomi-miot
two_finger_pan: true
title: Living Room Vacuum
append_tiles: true
map_modes:
  - name: Zone cleanup
    icon: mdi:select-drag
    run_immediately: false
    coordinates_rounding: true
    selection_type: MANUAL_RECTANGLE
    max_selections: 5
    repeats_type: EXTERNAL
    max_repeats: 3
    service_call_schema:
      service: xiaomi_miio.vacuum_clean_zone
      service_data:
        zone: '[[selection]]'
        repeats: '[[repeats]]'
        entity_id: '[[entity_id]]'
    predefined_selections: []
    variables: {}
  - name: Pin & Go
    icon: mdi:map-marker-plus
    run_immediately: false
    coordinates_rounding: true
    selection_type: MANUAL_POINT
    max_selections: 999
    repeats_type: NONE
    max_repeats: 1
    service_call_schema:
      service: xiaomi_miio.vacuum_goto
      service_data:
        x_coord: '[[point_x]]'
        y_coord: '[[point_y]]'
        entity_id: '[[entity_id]]'
    predefined_selections: []
    variables: {}
  - template: vacuum_clean_segment
    max_selections: 999
    predefined_selections:
      - id: '1'
        icon:
          name: mdi:broom
          x: 23850
          'y': 20150
        label:
          text: WC2
          x: 23850
          'y': 20150
          offset_y: 35
        outline:
          - - 22550
            - 19050
          - - 25150
            - 19050
          - - 25150
            - 21250
          - - 22550
            - 21250
      - id: '2'
        icon:
          name: mdi:broom
          x: 21950
          'y': 20150
        label:
          text: WC1
          x: 21950
          'y': 20150
          offset_y: 35
        outline:
          - - 21300
            - 19100
          - - 22600
            - 19100
          - - 22600
            - 21200
          - - 21300
            - 21200
      - id: '3'
        icon:
          name: mdi:broom
          x: 19050
          'y': 23625
        label:
          text: Kitchen
          x: 19050
          'y': 23625
          offset_y: 35
        outline:
          - - 18000
            - 21500
          - - 20100
            - 21500
          - - 20100
            - 25750
          - - 18000
            - 25750
      - id: '16'
        icon:
          name: mdi:broom
          x: 25775
          'y': 22975
        label:
          text: Office
          x: 25775
          'y': 22975
          offset_y: 35
        outline:
          - - 23250
            - 21200
          - - 28300
            - 21200
          - - 28300
            - 24750
          - - 23250
            - 24750
      - id: '17'
        icon:
          name: mdi:broom
          x: 21675
          'y': 23225
        label:
          text: Hall
          x: 21675
          'y': 23225
          offset_y: 35
        outline:
          - - 20050
            - 19950
          - - 23300
            - 19950
          - - 23300
            - 26500
          - - 20050
            - 26500
      - id: '18'
        icon:
          name: mdi:broom
          x: 18750
          'y': 20575
        label:
          text: Laundry
          x: 18750
          'y': 20575
          offset_y: 35
        outline:
          - - 17500
            - 20150
          - - 20000
            - 20150
          - - 20000
            - 21000
          - - 17500
            - 21000
      - id: '19'
        icon:
          name: mdi:broom
          x: 25100
          'y': 26450
        label:
          text: Living Room
          x: 25100
          'y': 26450
          offset_y: 35
        outline:
          - - 21950
            - 25050
          - - 28250
            - 25050
          - - 28250
            - 27850
          - - 21950
            - 27850
tiles:
  - tile_id: status
    entity: vacuum.roborock_s5_af4f_robot_cleaner
    label: Status
    attribute: status
    icon: mdi:robot-vacuum
    translations:
      starting: Starting
      charger disconnected: Charger disconnected
      idle: Idle
      remote control active: Remote control active
      cleaning: Cleaning
      returning home: Returning home
      manual mode: Manual mode
      charging: Charging
      charging problem: Charging problem
      paused: Paused
      spot cleaning: Spot cleaning
      error: Error
      shutting down: Shutting down
      updating: Updating
      docking: Docking
      going to target: Going to target
      zoned cleaning: Zoned cleaning
      segment cleaning: Segment cleaning
      emptying the bin: Emptying the bin
      charging complete: Charging complete
      device offline: Device offline
  - tile_id: battery_level
    entity: vacuum.roborock_s5_af4f_robot_cleaner
    label: Battery
    attribute: battery_level
    icon: mdi:battery
    unit: '%'
  - tile_id: fan_speed
    entity: vacuum.roborock_s5_af4f_robot_cleaner
    label: Fan speed
    attribute: fan_speed
    icon: mdi:fan
    translations:
      silent: Silent
      standard: Standard
      medium: Medium
      turbo: Turbo
      auto: Auto
      gentle: Gentle
icons:
  - icon: mdi:play
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: cleaning
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: error
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: returning
    tooltip: Start
    tap_action:
      action: call-service
      service: vacuum.start
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
  - icon: mdi:pause
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: docked
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: idle
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: error
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: paused
    tooltip: Pause
    tap_action:
      action: call-service
      service: vacuum.pause
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
  - icon: mdi:stop
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: docked
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: idle
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: error
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: paused
    tooltip: Stop
    tap_action:
      action: call-service
      service: vacuum.stop
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
  - icon: mdi:home-map-marker
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: docked
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        value_not: returning
    tooltip: Return to base
    tap_action:
      action: call-service
      service: vacuum.return_to_base
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
  - icon: mdi:map-marker
    tooltip: Locate
    tap_action:
      action: call-service
      service: vacuum.locate
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
  - icon: mdi:fan-remove
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value: Silent
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
        fan_speed: Standard
  - icon: mdi:fan-speed-1
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value: Standard
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
        fan_speed: Strong
  - icon: mdi:fan-speed-2
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value: Strong
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
        fan_speed: Turbo
  - icon: mdi:fan-speed-3
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value: Turbo
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
        fan_speed: Silent
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value_not: Silent
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value_not: Standard
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value_not: Strong
      - entity: vacuum.roborock_s5_af4f_robot_cleaner
        attribute: fan_speed
        value_not: Turbo
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s5_af4f_robot_cleaner
        fan_speed: Silent
map_locked: true

Screenshot_20231230_153025_Home Assistant
Screenshot_20231230_185751_Home Assistant

any revised code please?

@PiotrMachowski
Copy link
Owner

@FilipeOS do not use Miot integration with Roborock S5, use built-in Xiaomi Miio integration

@FilipeOS
Copy link

FilipeOS commented Jan 1, 2024

@FilipeOS do not use Miot integration with Roborock S5, use built-in Xiaomi Miio integration

Yes I tried that after I post here and I finally got everything working thank you.

@FilipeOS
Copy link

FilipeOS commented Jan 2, 2024

I just don't understand why I keep getting invalid calibration map when I open the vaccums... In configuration file I just have calibration points enabled since was all working and setup

@PiotrMachowski
Copy link
Owner

Calibration error is displayed when map is missing

@FilipeOS
Copy link

FilipeOS commented Jan 2, 2024

How can I prevent this from happening since on Xiaomi map is always there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new platform
Projects
None yet
Development

No branches or pull requests