I’ve got the roborock S4.
For the top left card the config is the following:
-
type: 'custom:card-templater'
entities:
- vacuum.roborock_s4
card:
type: picture-elements
image: /local/roborock_s4.jpg
elements:
-
type: state-label
entity: vacuum.roborock_s4
style:
left: 0
right: 0
bottom: 0
background-color: 'rgba(0, 0, 0, 0.3)'
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: icon
title: Battery
icon_template: '{{ state_attr("vacuum.roborock_s4", "battery_icon") }}'
style:
right: 171px
bottom: 0
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: state-label
title: 'Battery Level'
entity: sensor.roborock_s4_battery
style:
right: 120px
bottom: 0px
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: icon
title: 'Locate Vacuum'
icon: 'mdi:map-marker'
style:
right: 90px
bottom: 0
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: icon
title: 'Clean First Floor'
icon: 'mdi:broom'
tap_action:
action: call-service
service: mqtt.publish
service_data:
payload: 1
topic: /nodered/vacuum_first_floor
style:
right: 0
bottom: 0
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: icon
title: 'Return To Base'
icon: 'mdi:home-map-marker'
tap_action:
action: call-service
service: vacuum.return_to_base
service_data:
entity_id: vacuum.roborock_s4
style:
right: 45px
bottom: 0
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: state-label
entity: sensor.roborock_s4_last_cleaned
prefix: 'Last ran '
suffix: ' ago'
style:
background-color: 'rgba(0, 0, 0, 0.3)'
bottom: 85%
padding: 8px
font-size: 16px
line-height: 2px
color: white
transform: 'translate(0%,0%)'
-
type: state-label
prefix: 'Ran '
suffix: x
entity: sensor.roborock_s4_lifetime_cleaning_count
style:
background-color: 'rgba(0, 0, 0, 0.3)'
bottom: 85%
right: 0px
padding: 8px
font-size: 16px
line-height: 2px
color: white
transform: 'translate(0%,0%)'
width: 25%
-
type: state-label
prefix: 'Ran for '
suffix: ' hrs'
entity: sensor.roborock_s4_lifetime_cleaning_time
style:
background-color: 'rgba(0, 0, 0, 0.3)'
bottom: 72%
right: 0px
padding: 8px
font-size: 16px
line-height: 2px
color: white
transform: 'translate(0%,0%)'
width: 25%
-
type: state-label
entity: sensor.roborock_s4_lifetime_cleaned_area
prefix: 'Cleaned '
style:
background-color: 'rgba(0, 0, 0, 0.3)'
bottom: 59%
right: 0px
padding: 8px
font-size: 16px
line-height: 2px
color: white
transform: 'translate(0%,0%)'
width: 25%
Note this requires the lovelace-card-templater and a few custom template sensors. The sensor definitions look like the following:
sensor:
roborock_s4_battery:
friendly_name: 'Roborock S4 Battery'
value_template: '{{state_attr(''vacuum.roborock_s4'', ''battery_level'')}}'
unit_of_measurement: '%'
device_class: battery
roborock_s4_lifetime_cleaned_area:
friendly_name: 'Lifetime Cleaned Area'
value_template: '{{state_attr(''vacuum.roborock_s4'', ''total_cleaned_area'')}}'
unit_of_measurement: ㎡
roborock_s4_lifetime_cleaning_time:
friendly_name: 'Lifetime Cleaning Time'
value_template: '{{(state_attr(''vacuum.roborock_s4'', ''total_cleaning_time'') / 60)|round(1, ''floor'')}}'
# NOTE: This date is converted to be timezone aware in PDT so that it plays nice
# with some other templating functions and filters.
roborock_s4_last_cleaned:
friendly_name: 'Last Cleaned Date/Time'
value_template: '{{relative_time(strptime(as_timestamp(state_attr(''vacuum.roborock_s4'', ''clean_stop''))|timestamp_custom(''%Y-%m-%d %H:%M:%S%z''), ''%Y-%m-%d %H:%M:%S%z''))}}'
roborock_s4_lifetime_cleaning_count:
friendly_name: 'Lifetime Cleaning Count'
value_template: '{{state_attr(''vacuum.roborock_s4'', ''cleaning_count'')}}'
For the maintenance cards the config looks like:
-
type: picture-elements
image: /local/main_brush.png
elements:
-
type: state-label
title: '% Remaining Until Main Brush Should Be Replaced'
entity: sensor.roborock_s4_main_brush_remaining
style:
font-size: 30px
color: orange
left: 0px
right: 0px
bottom: 0px
background-color: 'rgba(0, 0, 0, 0.3)'
transform: 'translate(0%,0%)'
-
type: state-label
title: 'Hours Remaining Until Main Brush Should Be Replaced'
entity: sensor.roborock_s4_main_brush_hrs_remaining
suffix: ' left'
style:
right: 0px
bottom: 0px
padding: 10px
font-size: 16px
line-height: 16px
color: white
transform: 'translate(0%,0%)'
-
type: icon
icon: 'mdi:restart'
title: 'Reset Hours'
tap_action:
action: call-service
service: vacuum.send_command
service_data:
entity_id: vacuum.roborock_s4
command: reset_consumable
params:
- main_brush_work_time
confirmation:
text: 'Are you sure you want to reset the hours remaining counter for replacing the main brush?'
style:
top: 0px
right: 0px
padding: 7px
transform: 'translate(0%,0%)'
And the custom template sensors needed for the maintenance cards:
sensor:
roborock_s4_filter_remaining:
friendly_name: '% Filter Remaining'
unit_of_measurement: '%'
value_template: '{{((state_attr(''vacuum.roborock_s4'', ''filter_left'') / 150) * 100) | round | int}}'
roborock_s4_filter_hrs_remaining:
friendly_name: 'Filter Remaining Hours'
unit_of_measurement: hrs
value_template: '{{state_attr(''vacuum.roborock_s4'', ''filter_left'')}}'
roborock_s4_side_brush_remaining:
friendly_name: '% Side Brush Remaining'
unit_of_measurement: '%'
value_template: '{{((state_attr(''vacuum.roborock_s4'', ''side_brush_left'') / 200) * 100) | round | int}}'
roborock_s4_side_brush_hrs_remaining:
friendly_name: 'Side Brush Remaining Hours'
unit_of_measurement: hrs
value_template: '{{state_attr(''vacuum.roborock_s4'', ''side_brush_left'')}}'
roborock_s4_main_brush_remaining:
friendly_name: '% Main Brush Remaining'
unit_of_measurement: '%'
value_template: '{{((state_attr(''vacuum.roborock_s4'', ''main_brush_left'') / 300) * 100) | round | int}}'
roborock_s4_main_brush_hrs_remaining:
friendly_name: 'Main Brush Remaining Hours'
unit_of_measurement: hrs
value_template: '{{state_attr(''vacuum.roborock_s4'', ''main_brush_left'')}}'
roborock_s4_sensors_remaining:
friendly_name: '% Sensors Remaining'
unit_of_measurement: '%'
value_template: '{{((state_attr(''vacuum.roborock_s4'', ''sensor_dirty_left'') / 30) * 100) | round | int}}'
roborock_s4_sensors_hrs_remaining:
friendly_name: 'Sensors Remaining Hours'
unit_of_measurement: hrs
value_template: '{{state_attr(''vacuum.roborock_s4'', ''sensor_dirty_left'')}}'
Here’s a more detailed write up: https://aarongodfrey.dev/home%20automation/roborock_s4_lovelace_dashboard/