Here’s my working solution…
NB: Dashboard/button implementation is based on how I have set mine up because I like how it looks. Yours may differ
-
Create an input_boolean for each room. (ie: Helper > Toggle type)
-
In your dashboard, create custom:button-card buttons, which toggle an input boolean (one for each room).
type: custom:button-card
entity: input_boolean.kitchen
name: Kitchen
icon: mdi:stove
action: toggle
show_state: false
show_name: true
state:
- value: 'on'
color: cornflowerblue
- value: 'off'
color: grey
styles:
card:
- width: 80px
- height: 80px
- '--mdc-ripple-color': lightblue
- '--mdc-ripple-press-opacity': 0.5
- In your dashboard, create custom:button-card button to call the script when tapped.
type: custom:button-card
name: Clean
entity: vacuum.cheryl
icon: mdi:robot-vacuum
show_state: false
show_name: true
state:
- value: idle
color: lightgrey
- value: cleaning
color: teal
styles:
icon:
- animation: blink 2s infinite
styles:
card:
- width: 80px
- height: 80px
- '--mdc-ripple-color': lightblue
- '--mdc-ripple-press-opacity': 0.5
tap_action:
action: call-service
service: script.deebot_clean
service_data:
entity_id: vacuum.cheryl
Example below of my buttons (including those shown above.
- Check the room numbers that your deebot has set. I’m not sure exactly why, but the names don’t always correlate, especially if you rename rooms etc etc. For example, in my screen shot it has “default: -7 -12 -22 -21” which is four separate rooms. I think it has something to do with when you initially map rooms, then name and divide them.
Take note of the room numbers - ignore the room names.
- Create a script, as shown below. At this point, notice that I have entered the number 7 for the “rooms” variable. This is for testing and checking which rooms are which number.
description: Start a deebot cleaning task
variables:
queue: input_text.deebot_cheryl_queue
vacuum_bot: vacuum.cheryl
sequence:
- alias: Get room numbers
variables:
rooms: 7
- alias: Send cleaning job to vacuum
service: vacuum.send_command
data:
entity_id: "{{ vacuum_bot }}"
command: spot_area
params:
rooms: "{{ rooms }}"
cleanings: 1
enabled: true
- service: system_log.write
data:
level: error
message: "Deebot Clean Script: Rooms variable = {{ rooms }}"
enabled: false
alias: Deebot Clean
mode: single
-
Run the script, and watch the Ecovacs app to see which room is being cleaned. Stop the robot vac via the app. Make note of the room that is being cleaned and the room number in the script. Change the room number and run the script again, keeping track of which room is which number. Do this for all room numbers in your list from step 5.
-
Now youneed to map the names and numbers in a template. This is best achieved with several windows open.
- Window1 : Dashboard: with all your buttons configured, select one, to toggle and enable an input helper.
- Window 2: Using the Developer Tools > Template view, create a template as shown below. Use your room name input booleans in the “x” variable in the template. For the “y” variable, put all your room numbers (from step 5) in a comma separated list. My room numbers are 11, 17, 21, 11, 8, 12, 13, 3, 7, 0. Right now it doesn’t matter what order they are in because they definitely aren’t mapped “name < - > number” in the same order your type them. I have searched but can’t figure out how/why the mapping doesn’t correlate in order.
- One at a time, set an input_helper button/state to be on. You will see the “Result” on the right hand side of the Template view change.
- If the Result is not the room number that you expect based on which input_boolean you enabled, swap the two numbers in the “y” variable (Result and the expected room number) in your template list. Repeat this for all helpers and numbers, until your list is in the correct order - so that when you toggle a helper, the correct room number is shown in the Result.
- To check these are all correct, enable multiple input booleans to check that the template gives you a list of the expected room numbers.
Template:
{% set x = expand('input_boolean.kitchen', 'input_boolean.dining',
'input_boolean.living', 'input_boolean.master',
'input_boolean.entrance', 'input_boolean.study',
'input_boolean.bathroom', 'input_boolean.hallway', 'input_boolean.bed2',
'input_boolean.bed34') | map(attribute='state') | list %}
{% set y = [11, 17, 21, 11, 8, 12, 13, 3, 7, 0] %} {% set ns =
namespace (z=[]) %} {% for i in x %}
{% if i == 'on' %}
{% set ns.z = ns.z + [y[loop.index-1]] %}
{% endif %}
{% endfor%} {% set out = ns.z|join(', ') %} {{ out }}
Test by enabling multiple input_booleans for expected room number list.
- Update the Script, replacing the “rooms” variable with the template you tested above.
description: Start a deebot cleaning task
variables:
queue: input_text.deebot_cheryl_queue
vacuum_bot: vacuum.cheryl
sequence:
- alias: Get room numbers
variables:
rooms: >-
{% set x = expand('input_boolean.kitchen', 'input_boolean.dining',
'input_boolean.living', 'input_boolean.master',
'input_boolean.entrance', 'input_boolean.study',
'input_boolean.bathroom', 'input_boolean.hallway', 'input_boolean.bed2',
'input_boolean.bed34') | map(attribute='state') | list %}
{% set y = [11, 17, 21, 11, 8, 12, 13, 3, 7, 0] %} {% set ns =
namespace (z=[]) %} {% for i in x %}
{% if i == 'on' %}
{% set ns.z = ns.z + [y[loop.index-1]] %}
{% endif %}
{% endfor%} {% set out = ns.z|join(', ') %} {{ out }}
- alias: Send cleaning job to vacuum
service: vacuum.send_command
data:
entity_id: "{{ vacuum_bot }}"
command: spot_area
params:
rooms: "{{ rooms }}"
cleanings: 1
enabled: true
- service: system_log.write
data:
level: error
message: "Deebot Clean Script: Rooms variable = {{ rooms }}"
enabled: false
alias: Deebot Clean
mode: single



