Feature request: Support of Xiaomi Miot vacuum platform
fewdji opened this issue · comments
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 can you provide a more detailed description for these services? (including stuff passed in params)
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, ???
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?
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
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 👍
Agree with the first sentence.
Adding part of a value would be great!
Thank you!
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: ...
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.
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
How did you find out about the exact values needed for
clean-extend-data
and thework 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
I used modificated version of MiHome (by vevs). It allows to log all command which sends to the vacuum.
Thanks!
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.
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]]}'
Recently it turned out that it's possible to use jinja templates in service_data
, so you can select multiple zones/rooms using following config:
-
Vacuum zone
- template: vacuum_clean_zone max_selections: 5 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":[{% for s in [[selection]] %}[{{s|join(",")}},[[repeats]],1,1]{% if not loop.last %},{% endif %}{% endfor %}]}' force_params: true
-
Vacuum room
- template: vacuum_clean_segment max_selections: 5 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":[{% for s in [[selection]] %}[{{s}},[[repeats]],1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}' force_params: true predefined_selections: ...
Great! Thanks a lot!
@inviz-ize please confirm if it works
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.
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
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
}
Checked this. Works fine.
Hmmm, is there anything in logs? Maybe resolving templates doesn't work for all services...
:( 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:
...
I'm getting such errors:
State is not JSON serializable: <state persistent_notification.notification=notifying; message=Template("{"selects":[{% for s in [3,6] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}"), title=Command to vacuum.ksiushka, friendly_name=Command to vacuum.ksiushka @ 2022-04-15T10:52:54.658237+03:00>: Object of type Template is not JSON serializable
Unable to serialize to JSON. Bad data found at $.event.a.persistent_notification.notification.a.message=Template("{"selects":[{% for s in [3,6] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}")(<class 'homeassistant.helpers.template.Template'>
Unable to serialize to JSON. Bad data found at $.event(Event: state_changed).data.new_state(State: persistent_notification.notification).attributes.message=Template("{"selects":[{% for s in [3,6] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}")(<class 'homeassistant.helpers.template.Template'>
Unable to serialize to JSON. Bad data found at $.result[1].message=Template("{"selects":[{% for s in [3,6] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}")(<class 'homeassistant.helpers.template.Template'>
Unable to serialize to JSON. Bad data found at $.result[0].message=Template("{"selects":[{% for s in [3,6] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}")(<class 'homeassistant.helpers.template.Template'>
Maybe it's only my problems and we need someone else to test it.
Tested in devtools one more time.
service: persistent_notification.create
data:
message: '{"selects":[{% set test = [1,2] %}{% for s in test %}[{{s}},1,3,3,1]{% if not loop.last %},{% endif %}{% endfor %}]}'
title: Test notification
notification_id: 1234
but the same with miot call outputs nothing:
service: xiaomi_miot.call_action
data:
entity_id: vacuum.ksiushka
siid: 18
aiid: 1
params:
- piid: 1
value: 18
- piid: 21
value: >-
{"selects":[{% set test = [1,2] %}{% for s in test %}[{{s}},1,3,3,1]{%
if not loop.last %},{% endif %}{% endfor %}]}
force_params: true
So looks like this service doesn't support Jinja templates and it would be better to do a native support for this platform.
I will not add native support for Xiaomi Miot because it's not possible (as said above). I can add support for jinja templates
If there are no other variants except jinja templates support than they will also be good. Hope this will work. Thanks a lot.
HA Core was updated and as I understood now there is possibility to use “for each” and “if” logic in yaml. Can it help try to avoid using jinja templates and do the same as we tried before from the box?
It doesn't change anything - it works only in scripts and automations.
Fun fact: feature request for for_each
was created by me 😉
Really funny fact :) , but sad that it works only in scripts and automations. Only this part does not allow me to use the card completely. I even picked up the correct calibration points.
I'm sorry for the very stupid question, but can somebody clarify where I have to add the code you discussed in this issue? If I add it to the configuration.yaml is not valid. Should it be placed in a specific section?
EDIT: Very dumb question, it goes in the card configuration. I still have to figure out the proper config for my vacuum, though.
When I try to do room or zone cleaning I get this one. Can you help me?
Odkurzacz(dreame.vacuum.p2029): Call miot action {'did': 'action-4-1', 'siid': 4, 'aiid': 1, 'in': [{'piid': 1, 'value': 19}, {'piid': 10, 'value': '{"areas":[{% for s in [[2606,1461,4590,3995]] %}[{{s|join(",")}},1,1,1]{% if not loop.last %},{% endif %}{% endfor %}]}'}]} failed: {'code': -9999, 'message': 'user ack timeout'}
Odkurzacz(dreame.vacuum.p2029): Call miot action {'did': 'action-4-1', 'siid': 4, 'aiid': 1, 'in': [{'piid': 1, 'value': 18}, {'piid': 10, 'value': '{"selects":[{% for s in [2,4,3,1] %}[{{s}},1,1,3,3]{% if not loop.last %},{% endif %}{% endfor %}]}'}]} failed: {'code': -9999, 'message': 'user ack timeout'}
Use this config
#251 (comment)
For those who have a 1C vacuum cleaner 'dreame.vacuum.mc1808'
This setting works for 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: vacuum.*****_miot
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
Hi, I have finally configured the map with my Dreame L10 Pro and Miot integration and the map extractor. It took me a while, so here's the config I'm using.
Config
predefined_selections (rooms) populated with Map Extractor data found in Developer Tools
type: custom:xiaomi-vacuum-map-card
entity: vacuum.myvacuum
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.call_action
service_data:
entity_id: vacuum.myvacuum
siid: 4
aiid: 1
params:
- piid: 1
value: 19
- piid: 10
value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
force_params: true
- template: vacuum_clean_segment
max_selections: 5
repeats_type: EXTERNAL
max_repeats: 3
service_call_schema:
service: xiaomi_miot.call_action
service_data:
entity_id: vacuum.myvacuum
siid: 4
aiid: 1
params:
- piid: 1
value: 18
- piid: 10
value: '{"selects":[[[[selection_unwrapped]],[[repeats]],3,3,1]]}'
force_params: true
predefined_selections:
- id: 5
label:
text: Room 5
x: -4125
'y': -2625
offset_y: 35
icon:
name: mdi:broom
x: -4125
'y': -2625
- id: 4
label:
text: Room 4
x: -500
'y': -2675
offset_y: 35
icon:
name: mdi:broom
x: -500
'y': -2675
- id: 3
label:
text: Room 3
x: -2025
'y': -975
offset_y: 35
icon:
name: mdi:broom
x: -2025
'y': -975
- id: 7
label:
text: Room 7
x: -4325
'y': 425
offset_y: 35
icon:
name: mdi:broom
x: -4325
'y': 425
- id: 2
label:
text: Room 2
x: 600
'y': 1750
offset_y: 35
icon:
name: mdi:broom
x: 600
'y': 1750
- id: 6
label:
text: Room 6
x: -4900
'y': 2700
offset_y: 35
icon:
name: mdi:broom
x: -4900
'y': 2700
- id: 1
label:
text: Room 1
x: -3475
'y': 3075
offset_y: 35
icon:
name: mdi:broom
x: -3475
'y': 3075
title: Mappa Robot
vacuum_platform: send_command
map_locked: true
Even though the map does update on the mobile App quite frequently, the Map in HA does not update after the first time. Eventually after some minutes gets refreshed, but is unusable. With my old Xiaomi/Roborock the HA refresh was synced with the App.
What is going wrong here?
@auanasgheps unfortunately that seems to be a common problem with Dreame devices. Right now I don't know a solution to this issue.
Thanks for sharing your config, I have created a dedicated section to share Xiaomi MIoT presets and included it here as well
Great, I was looking forward to some kind of repository to share the MioT presets! Hopefully we can also figure out the go to point scheme.
I also looked at the logs and I can't find any issue, so I believe there is something in the process that is not optimized.
@auanasgheps my guess is that Xiaomi Home app communicates directly with a vacuum and triggers sending data to the cloud/retrievers map data directly from a vacuum.
@auanasgheps my guess is that Xiaomi Home app communicates directly with a vacuum and triggers sending data to the cloud/retrievers map data directly from a vacuum.
This could be an explanation, since this vacuum also supports LAN commands in the MiioT integration. However sometimes I've noticed delay in the app map too.
@PiotrMachowski I have reproduced the issue and confirmed how is the current behaviour.
The HA Map card will never update unless you open the mobile app.
Once the user opens the mobile app, the HA Map will update once.
Even if you keep the app open, the HA Map doesn't refresh even if the app does update.
To trigger a refresh, you have to exit the vacuum on the app and re-enter again to trigger another single refresh.
So far we rely on the app opening, this sucks.
I have grabbed the Mobile app's log to see what commands are send to the vacuum. I see a lot of calls regarding "get_properties" and these are MioT commands. I can share the logs privately with you. Maybe you could implement the same logic?
@auanasgheps sure, you can send me logs. Please create a dedicated feature request in Map Extractor to avoid further off-topic discussion here
- 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.*****_miot
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
Hi, I modifided this code on service and entity to my viomi v5 pro. And add it to cards config but got error. Also the siid and aiid etc is not the same but error is not about action and service call.
Configuration errors detected:
bad indentation of a mapping entry (10:20)
7 | map_modes:
8 | - template: vacuum_goto
9 | - template: vacuum_clean_zone
10 | max_selections: 1
-------------------------^
11 | repeats_type: EXTERNAL
12 | max_repeats: 5
You have to fix indentation, it is really important in yaml
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
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
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
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
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
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
@lokaelmo #318
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
thanks for replying, I can't see the attachment, where can I find the orange start button
@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.
ok, thanks a lot
Does someone here have a template for the z10 pro?
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?
- 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
Thank you very much @PiotrMachowski. It worked! 🎉
Hey. Is it possible to use the GoTo action with xiaomi miot?
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.
Was anyne able to integrate Xiaomi S12?
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
any revised code please?
@FilipeOS do not use Miot integration with Roborock S5, use built-in Xiaomi Miio integration
@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.
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
Calibration error is displayed when map is missing
How can I prevent this from happening since on Xiaomi map is always there?