Scripts are called by saying Start (mind you you can not stop a script).
So “Hey google, Start vacuum bathroom” will start the script.
i think you can also say “ok google, activate script name”
You can say "ok google, activate script name " or "ok google, start script name ".
I’ve only got one vacuum script at the moment, and I aliased it “The Vacuum”, so to call it I say “ok google, start The Vacuum” and away it goes.
Personally, I created a switch so that I can say “Hey Google, Turn on the Vacuum.”
vacuum:
value_template: '{% if is_state("vacuum.vacuum", "cleaning") %} on {% elif is_state("vacuum.vacuum", "docked") %} off {% else %} failed {% endif %}'
friendly_name: "Vacuum"
turn_on:
service: vacuum.turn_on
turn_off:
service: vacuum.stop
I use IFTTT and node-red handles my command. I can say “Hey Google, clean the <room/area name>” and my robot gets the command to clean the zone that I set for those names.
That’s the v2. I’m guessing you have the v1, like me. The latest fw for ours is 003514 and it doesn’t have the features that the v2 got with 001632.
Thread discussing 003514 says its rootable - https://www.roboter-forum.com/index.php?thread/31985-firmware-3-3-9-003514/
EDIT: Bad news for v1 owners. Looks like our vac will not be getting virtual walls, map saving etc.
Suggestions/Improvements:
- Multiple room zoned cleaning - clicking on multiple rooms in any UI should queue up in the zoned cleaning.
- One way to achieve this could be to use input_boolean for each room and then use a string global variable (custom component https://github.com/rogro82/hass-variables) to store the zones to be cleaned. This string can be using in the zone cleaning command.
- Another way could be using the scripts and wait_template commands within the scripts. So, if I fire up the script for room A, and then the one for room B -> B will wait for A to finish before starting.
- Number of passes can be stored in input_number and used in the scripts. https://www.home-assistant.io/components/input_number/
I am having issues that no matter what command Google and IFTTT pass on it only will clean the kitchen. Below is the full set of scripts. I m sure it is easy what i am doing wrong, i know the bottom scripts work to clean the proper zones when i call them via HA.
vacuum_room_select:
sequence:
- service: script.turn_on
data_template:
entity_id: >
{% if (room== "kitchen" or "the kitchen") %}
script.vacuum_kitchen
{% elif (room== "living room" or "the living room") %}
script.vacuum_living_room
{% elif (room== "pantry" or "the pantry") %}
script.vacuum_pantry
{% elif (room== "dining room" or "the dining room") %}
script.vacuum_dining_room
{% elif (room== "spare bedroom" or "the spare bedroom") %}
script.vacuum_spare_bedroom
{% elif (room== "spare bathroom" or "the spare bathroom") %}
script.vacuum_spare_bathroom
{% elif (room== "computer room" or "the computer room") %}
script.vacuum_computer_room
{% elif (room== "front bathroom" or "the front bathroom") %}
script.vacuum_front_bathroom
{% elif (room== "entry hall" or "the entry hall") %}
script.vacuum_entry_hall
{% elif (room== "go home" or "go to your home" or "go to dock" or "go to base") %}
script.vacuum1_home
{% elif (room== "stop cleaning" or "stop" or "stop vacuuming") %}
script.vacuum1_stop
{% endif %}
vacuum1_stop:
alias: "Vacuum Stop"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: stop
vacuum1_home:
alias: "Vacuum go home"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: return_to_base
vacuum_kitchen:
alias: "Vacuum the Kitchen"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[22500, 30000, 28500, 33750, 2]]
vacuum_pantry:
alias: "Vacuum the Pantry"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[19500, 30500, 23500, 32000, 2]]
vacuum_living_room:
alias: "Vacuum the Living Room"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[25500, 25250, 30000, 31000, 2]]
vacuum_dining_room:
alias: "Vacuum the Dining Room"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[22000, 25250, 26500, 30000, 2]]
vacuum_spare_bedroom:
alias: "Vacuum the Spare Bedroom"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[30500, 25000, 34000, 28500, 2]]
vacuum_spare_bathroom:
alias: "Vacuum the Spare Bathroom"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[31750, 28750, 33250, 30500, 2]]
vacuum_computer_room:
alias: "Vacuum the Computer Room"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[28500, 30500, 34000, 34750, 2]]
vacuum_front_bathroom:
alias: "Vacuum the Front Bathroom"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[31000, 37750, 34000, 38750, 2]]
vacuum_entry_hall:
alias: "Vacuum the Entry Hall"
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.rosy
command: app_zoned_clean
params: [[28500, 31000, 31000, 40000, 2]]
I’m surprised that you don’t get some sort of syntax error as I’m pretty sure your if statements should say
room==“kitchen” or room==“the kitchen”
Patrick is right.
What I am using (also to avoid an issue with capital/lower case letters) is the following:
{% if 'küche' in raum|lower %}
script.saugen_kueche
{% elif 'fliesen' in raum|lower or 'fließen' in raum|lower%}
script.saugen_fliesen
{% elif 'flur' in raum|lower %}
script.saugen_flur
{% elif 'bad' in raum|lower %}
script.saugen_bad
{% elif 'wischen' in raum|lower %}
script.saugen_wohnzimmer_wischen
{% elif 'wohnzimmer' in raum|lower %}
script.saugen_wohnzimmer
{% elif 'teppich' in raum|lower %}
script.saugen_teppich
{% elif 'parkett' in raum|lower %}
script.saugen_parkett
{% elif 'schlafzimmer' in raum|lower %}
script.saugen_schlafzimmer
{% elif 'wohnung' in raum|lower %}
script.saugen_wohnung
{% endif %}
You would not have to check for “the” anymore, since it looks for the room name in your sentence. “raum|lower” just takes the word that was passed through IFTTT and makes it lower case (in German nouns are capitalized but Google for some reason fails to capitalize them, so to avoid errors and made them all lower).
I think you guys/gals are doing great work, can wait to start playing. One question, has anyone mapped a room and set up a program to go around a rug? I have a few high pile rugs a Rosie gets stuck, so it would be nice to be able to tell her to avoid certain areas.
Thanks
If you have the new firmware you should in theory be able to create “no-go” areas. Although this isn’t implemented in HA yet, you still should be able to send the command in raw format to the vacuum - but I haven’t looked into that at all.
It’s disappointing that the v1 Mi Robot Vacuum isn’t getting the software updates for the no-go areas and the ability to save the map. Especially since they are seemingly very similar in their sensors. I think those 2 abilities, and the ability to set zone names so you can tell it, “Hey Google, vacuum the Kitchen”, would really push this to the next level.
^
Well, this you can do with the v1 already if you use HA and IFTTT as described in this howto
Thanks this was way easier!
I tried to implement the multiroom selection feature with input_booleans for each room. The following scripts then go through all my rooms and check if the input_boolean for the room is selected. If the boolean is selected a script containing the correct zone coordinates is called:
vacuum_clean_room:
alias: Raum reinigen
sequence:
- condition: template
value_template: "{{ is_state(room_bool, 'on') }}"
- service: script.turn_on
data_template:
entity_id: '{{ room_cleaner }}'
- delay: '00:00:30'
- wait_template: "{{ (is_state('vacuum.roborock', 'docked'))or (is_state('vacuum.roborock', 'idle'))}}"
- service: input_boolean.turn_off
data_template:
entity_id: '{{ room_bool }}'
- delay: '00:00:01'
vacuum_selected:
alias: Auswahl saugen
sequence:
- service: script.vacuum_clean_room
data_template:
room_cleaner: script.vacuum_wohnzimmer
room_bool: input_boolean.wohnzimmer
- wait_template: "{{ is_state('script.vacuum_clean_room', 'off') }}"
- service: script.vacuum_clean_room
data_template:
room_cleaner: script.vacuum_bad
room_bool: input_boolean.bad
- wait_template: "{{ is_state('script.vacuum_clean_room', 'off') }}"
- service: script.vacuum_clean_room
data_template:
room_cleaner: script.vacuum_kueche
room_bool: input_boolean.kueche
- wait_template: "{{ is_state('script.vacuum_clean_room', 'off') }}"
- service: script.vacuum_clean_room
data_template:
room_cleaner: script.vacuum_schlaf
room_bool: input_boolean.schlafzimmer
- wait_template: "{{ is_state('script.vacuum_clean_room', 'off') }}"
- service: script.vacuum_clean_room
data_template:
room_cleaner: script.vacuum_flur
room_bool: input_boolean.flur
I still have a problem though, because my xiaomi vacuum has to return to the dock after every zone cleaning. It seems I can’t stop it from returning with any command from home assistant and can’t get it to start an other zone cleanup, before it is in the dock.
Anyone has any idea how I can improve my scripts or stop the vacuum on the way back to the dock?
I just had some time and tried to build a string containing all the zones I want to clean from the input_booleans and give it to the app_zoned_clean command in one go. I then realized that the list that is given to the command in fact is no string and as it seems it is not allowed to be a string.
It didn’t work everytime I tried to use data_template instead of data for the command like this:
- service: vacuum.send_command
# not working!
data_template:
entity_id: vacuum.roborock
command: app_zoned_clean
params: [[21000, 23200, 23900, 27200, 1]]
or this
- service: vacuum.send_command
# not working!
data_template:
entity_id: vacuum.roborock
command: app_zoned_clean
params: '{{ zones }}'
I think data_template interprets every input paramater as string. Because I cannot use data_template I also can’t give it a list via script. Everytime I tried, the vacuum said it started the zoned_cleanup, but it didn’t have any zone and just started a full cleanup instead.
Also it seems to be impossible to make one script that checks an input_number and changes the number of times the zone should be cleaned according to it, because we can’t use the input_number as a parameter in the list without templates.
Did nobody else encounter this problem or am I just missing something obvious?
Also tried and couldn’t use a data_template for that service, I suppose it is a limitation on the service definition.
Still then, as a heads-up, I tried building a string with 7 division coordinates (fixed ones) and it stopped after the 5th, it seems like a limitation, because it ran ok until the 5th and stopped. This would be ok if it wasn’t for this limitation, because actually vacuum doesn’t go to the dock between different division coordinates.
Hello.
May I ask where did you get that information about the v1 and the fact that it won’t get the updates with the ability to save maps and no-go areas?
Thanks
Am i being dense … how do you find the x y cordinates …trail and error?