Did a couple updates on my setup. I added an icon for the battery status. I also removed the specific values for rooms and replaced them with the entity attributes. (I noticed that each time I tweaked my setup, the numbers for each room changed)
For lovelace GUI:
cards:
- buttons:
locate: false
pause: false
return: false
spot: false
start: false
stop: false
entity: vacuum.roomba
image: /local/deebot.jpg
name: Roomba
type: 'custom:xiaomi-vacuum-card'
vendor: deebot
- cards:
- color: white
entity: null
icon: 'mdi:map-marker-radius'
name: Find
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.locate
service_data:
entity_id: vacuum.roomba
type: 'custom:button-card'
- color: white
entity: null
icon: 'mdi:play'
name: Auto
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.start
service_data:
entity_id: vacuum.roomba
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- input_boolean.deebot_dining_room
- input_boolean.deebot_kitchen
- input_boolean.deebot_living_room
- input_boolean.deebot_bedroom
- input_boolean.deebot_bathroom
- input_boolean.deebot_closet
- input_boolean.deebot_back_hall
- input_boolean.deebot_entry
card:
type: 'custom:button-card'
color: white
entity: null
icon: 'mdi:view-dashboard-outline'
name: Rooms
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: script.vacuum_clean_zone
- color: white
entity: null
icon: 'mdi:pause'
name: Pause
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.pause
service_data:
entity_id: vacuum.roomba
type: 'custom:button-card'
- color: white
entity: null
icon: 'mdi:robot-vacuum'
name: Dock
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.return_to_base
service_data:
entity_id: vacuum.roomba
type: 'custom:button-card'
type: horizontal-stack
- cards:
- color: yellow
entity: input_boolean.deebot_kitchen
icon: 'mdi:toaster-oven'
name: Kitchen
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_living_room
icon: 'mdi:sofa'
name: Family Room
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_bedroom
icon: 'mdi:bed-king'
name: Bedroom
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_bathroom
icon: 'mdi:shower'
name: Bathroom
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
type: horizontal-stack
- cards:
- color: yellow
entity: input_boolean.deebot_closet
icon: 'mdi:hanger'
name: Closet
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_back_hall
icon: 'mdi:toilet'
name: Guest Hallway
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_entry
icon: 'mdi:door-open'
name: Foyer
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
- color: yellow
entity: input_boolean.deebot_dining_room
icon: 'mdi:silverware-variant'
name: Dining Room
state:
- color: 'rgb(100, 100, 100)'
value: 'off'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
type: horizontal-stack
- cards:
- type: 'custom:config-template-card'
entities:
- sensor.deebot_fan_speed
variables:
- 'states[''sensor.deebot_fan_speed''].state'
card:
color: '${vars[0] === ''quiet'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:fan'
name: Quiet
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.set_fan_speed
service_data:
entity_id: vacuum.roomba
fan_speed: quiet
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.deebot_fan_speed
variables:
- 'states[''sensor.deebot_fan_speed''].state'
card:
color: '${vars[0] === ''normal'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:fan'
name: Normal
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.set_fan_speed
service_data:
entity_id: vacuum.roomba
fan_speed: normal
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.deebot_fan_speed
variables:
- 'states[''sensor.deebot_fan_speed''].state'
card:
color: '${vars[0] === ''max'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:fan'
name: Max
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.set_fan_speed
service_data:
entity_id: vacuum.roomba
fan_speed: max
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.deebot_fan_speed
variables:
- 'states[''sensor.deebot_fan_speed''].state'
card:
color: '${vars[0] === ''max+'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:fan'
name: Max+
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.set_fan_speed
service_data:
entity_id: vacuum.roomba
fan_speed: max+
type: 'custom:button-card'
- color: 'rgb(0, 255, 0)'
entity: input_boolean.deebot_times
icon: 'mdi:numeric-2'
name: Clean Cycles
state:
- color: 'rgb(255, 0, 0)'
value: 'off'
icon: 'mdi:numeric-1'
styles:
card:
- font-size: 12px
- background-color: black
- color: white
type: 'custom:button-card'
type: horizontal-stack
- cards:
- type: 'custom:config-template-card'
entities:
- sensor.roomba_water_level
variables:
- 'states[''sensor.roomba_water_level''].state'
card:
color: '${vars[0] === ''low'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:flask-empty-outline'
name: Low
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.send_command
service_data:
command: set_water
entity_id: vacuum.roomba
params:
amount: low
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.roomba_water_level
variables:
- 'states[''sensor.roomba_water_level''].state'
card:
color: '${vars[0] === ''medium'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:flask-outline'
name: Medium
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.send_command
service_data:
command: set_water
entity_id: vacuum.roomba
params:
amount: medium
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.roomba_water_level
variables:
- 'states[''sensor.roomba_water_level''].state'
card:
color: '${vars[0] === ''high'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:flask-empty'
name: High
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.send_command
service_data:
command: set_water
entity_id: vacuum.roomba
params:
amount: high
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.roomba_water_level
variables:
- 'states[''sensor.roomba_water_level''].state'
card:
color: '${vars[0] === ''ultrahigh'' ? ''yellow'' : ''white''}'
entity: null
icon: 'mdi:flask-empty-plus'
name: Ultrahigh
styles:
card:
- font-size: 12px
- background-color: black
- color: white
tap_action:
action: call-service
service: vacuum.send_command
service_data:
command: set_water
entity_id: vacuum.roomba
params:
amount: ultrahigh
type: 'custom:button-card'
- type: 'custom:config-template-card'
entities:
- sensor.roomba_water_level
variables:
- states.vacuum.roomba.battery_icon
card:
color: white
entity: null
icon: '[[[return states[''vacuum.roomba'' ].attributes.battery_icon]]]'
name: '[[[return states[''vacuum.roomba'' ].attributes.battery_level]]]'
styles:
card:
- font-size: 12px
- font-weight: bold
- background-color: black
- color: white
icon:
- color: |
[[[
if (states['vacuum.roomba' ].attributes.battery_level < 40) return 'red';
else if (states['vacuum.roomba' ].attributes.battery_level < 85) return 'yellow';
else return 'green';
]]]
type: 'custom:button-card'
type: horizontal-stack
type: vertical-stack
In addition to using attributes for room numbers, I also added an āerror echeckā so that if the script did not detect a room, just vacuum the balcony (my smallest zone).
updated clean_a_room
script:
clean_a_room:
alias: Clean a Room
sequence:
- service: input_text.set_value
data_template:
entity_id: input_text.valueroom
value: '{{room}},'
- service: vacuum.send_command
data_template:
command: spot_area
entity_id: vacuum.roomba
params:
cleanings: "{% set y = room %} {% set y = y | lower %} {% if \"2\" in y or\
\ \"twice\" in y %} {% set y = \"2\" %} {% else %} {% set y = \"1\" %} {%\
\ endif %} {{y}} \n"
rooms: '{% set x = room %} {% set x = x | lower
%} {% if "house" in x %} {% set x = (states[''vacuum.roomba'' ].attributes.room_living_room|string+","+states[''vacuum.roomba'' ].attributes.room_bedroom|string+","+ states[''vacuum.roomba'' ].attributes.room_bathroom|string+","+states[''vacuum.roomba'' ].attributes.room_storeroom|string+","+states[''vacuum.roomba'' ].attributes.room_dining_room|string+","+states[''vacuum.roomba'' ].attributes.room_kitchen|string+","+states[''vacuum.roomba'' ].attributes.room_corridor|string+","+states[''vacuum.roomba'' ].attributes.room_balcony|string+",") %} {% else %}
{% set x = x | replace(",","") %} {% set x = x | replace("master ","") %}
{% set x = x | replace("2","") %} {% set x = x | replace("bedroom",states[''vacuum.roomba'' ].attributes.room_bedroom|string+",")
%} {% set x = x | replace("family room",states[''vacuum.roomba'' ].attributes.room_living_room|string+",") %} {% set x = x | replace("living
room",states[''vacuum.roomba'' ].attributes.room_living_room|string+",") %} {% set x = x | replace("dining room",states[''vacuum.roomba'' ].attributes.room_dining_room|string+",") %} {% set x =
x | replace("kitchen",states[''vacuum.roomba'' ].attributes.room_kitchen|string+",") %} {% set x = x | replace("guest bathroom",states[''vacuum.roomba'' ].attributes.room_corridor|string+",")
%} {% set x = x | replace("guest bath",states[''vacuum.roomba'' ].attributes.room_corridor|string+",") %} {% set x = x | replace("bathroom",states[''vacuum.roomba'' ].attributes.room_bathroom|string+",")
%} {% set x = x | replace("closet",states[''vacuum.roomba'' ].attributes.room_storeroom|string+",") %} {% set x = x | replace("back hall",states[''vacuum.roomba'' ].attributes.room_corridor|string+",")
%} {% set x = x | replace("hallway",states[''vacuum.roomba'' ].attributes.room_corridor|string+",") %} {% set x = x | replace("entry",states[''vacuum.roomba'' ].attributes.room_balcony|string+",")
%} {% set x = x | replace("foyer",states[''vacuum.roomba'' ].attributes.room_balcony|string+",") %} {% set x = x | replace(" times","") %} {% set x = x | replace("
twice","") %} {% set x = x | replace(" and ","") %} {% set x = x | replace("the
","") %} {% set x = x | regex_replace("[^0-9,]","")
%} {% endif %} {% if x=="" %} {% set x=states[''vacuum.roomba'' ].attributes.room_balcony|string+"," %} {% endif %} {{x}}'
mode: single
and updated vacuum_clean_zone
:
vacuum_clean_zone:
alias: Clean Zone
sequence:
- service: vacuum.send_command
data_template:
command: spot_area
entity_id: vacuum.roomba
params:
cleanings: '{%- if is_state(''input_boolean.deebot_times'', ''on'') -%}{{2|int}}{%-
else -%}{{1|int}}{% endif %}
'
rooms: >
{% set x='' %} {%- if is_state('input_boolean.deebot_living_room','on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_living_room|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_bedroom', 'on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_bedroom|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_bathroom', 'on') -%}{% set x=x + states['vacuum.roomba' ].attributes.room_bathroom|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_closet', 'on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_storeroom|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_dining_room','on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_dining_room|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_back_hall', 'on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_corridor|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_kitchen', 'on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_kitchen|string+',' %} {%- endif -%}
{%- if is_state('input_boolean.deebot_entry', 'on') -%} {% set x=x + states['vacuum.roomba' ].attributes.room_balcony|string+',' %} {%- endif -%} {{x}}
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_kitchen
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_bedroom
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_bathroom
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_living_room
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_dining_room
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_back_hall
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_entry
- service: input_boolean.turn_off
data:
entity_id: input_boolean.deebot_times