Já há algum tempo estava para criar um cartão personalizado para o meu Aspirador Xiaomi S50 Roborock. Finalmente dediquei-me a ele.
Estas são as imagens que utilizei. É só colocar na pasta /config/www/img/
As 1ªas 4 imagens são alternativas para imagem de fundo, a última é o logo que leva no canto inferior direito do cartão.
Código lovelace:
type: picture-elements
image: /local/img/vacuum_blue.jpg
elements:
- entity: vacuum.xiaomi_vacuum_cleaner
style:
'--paper-item-icon-color': '#FFF'
left: 5%
top: 5%
z-index: 1
tap_action:
action: more-info
type: state-icon
- entity: script.vacuum_start
style:
'--paper-item-icon-color': '#FFF'
left: 95%
top: 5%
z-index: 1
tap_action:
action: toggle
type: state-icon
- entity: script.vacuum_pause
style:
'--paper-item-icon-color': '#FFF'
left: 95%
top: 15%
z-index: 1
tap_action:
action: toggle
type: state-icon
- entity: script.vacuum_stop
style:
'--paper-item-icon-color': '#FFF'
left: 95%
top: 25%
z-index: 1
tap_action:
action: toggle
type: state-icon
- entity: script.vacuum_return_to_base
style:
'--paper-item-icon-color': '#FFF'
left: 95%
top: 35%
z-index: 1
tap_action:
action: toggle
type: state-icon
- entity: script.vacuum_locate
style:
'--paper-item-icon-color': '#FFF'
left: 95%
top: 45%
z-index: 1
tap_action:
action: toggle
type: state-icon
- entity: sensor.vacuum_battery
style:
background-color: '#278ef7'
color: '#FFF'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 0%
pointer-events: none
text-shadow: 1px 1px black
top: 60%
transform: none
z-index: 1
tap_action:
action: none
type: state-label
- entity: sensor.vacuum_status
style:
background-color: '#278ef7'
color: '#FFF'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 0%
pointer-events: none
text-shadow: 1px 1px black
top: 75%
transform: none
z-index: 1
tap_action:
action: none
type: state-label
- entity: sensor.vacuum_cleaned_area
style:
background-color: '#278ef7'
color: '#FFF'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 0%
pointer-events: none
text-shadow: 1px 1px black
top: 90%
transform: none
z-index: 1
tap_action:
action: none
type: state-label
- image: /local/img/mi.png
style:
left: 93%
top: 93%
width: 7%
z-index: 0
tap_action:
action: none
type: image
- camera_image: camera.vacuum_map
entity: camera.vacuum_map
style:
height: 80%
left: 10%
top: 10%
transform: none
width: 80%
z-index: 0
tap_action:
action: more-info
type: image
Código configuration.yaml:
homeassistant:
customize:
vacuum.xiaomi_vacuum_cleaner:
friendly_name: "Roborock S50"
script.vacuum_start:
friendly_name: "Iniciar limpeza"
icon: 'mdi:play'
script.vacuum_pause:
friendly_name: "Pausar"
icon: 'mdi:pause'
script.vacuum_stop:
friendly_name: "Parar"
icon: 'mdi:stop'
script.vacuum_return_to_base:
friendly_name: "Regressar à base"
icon: 'mdi:vhs'
script.vacuum_locate:
friendly_name: "Localizar"
icon: 'mdi:map-marker'
script:
vacuum_start:
sequence:
- service: vacuum.start
data: { "entity_id":"vacuum.xiaomi_vacuum_cleaner"}
vacuum_pause:
sequence:
- service: vacuum.pause
data: { "entity_id":"vacuum.xiaomi_vacuum_cleaner"}
vacuum_stop:
sequence:
- service: vacuum.stop
data: { "entity_id":"vacuum.xiaomi_vacuum_cleaner"}
vacuum_return_to_base:
sequence:
- service: vacuum.return_to_base
data: { "entity_id":"vacuum.xiaomi_vacuum_cleaner"}
vacuum_locate:
sequence:
- service: vacuum.locate
data: { "entity_id":"vacuum.xiaomi_vacuum_cleaner"}
sensor:
- platform: template
sensors:
# Status
vacuum_status:
friendly_name: "Estado"
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: >
{% set val = states.vacuum.xiaomi_vacuum_cleaner.attributes.status %}
{% if val == 'Charging' %}
A Carregar
{% elif val == 'Cleaning' %}
A limpar
{% elif val == 'Returning home' %}
Regressar à base
{% elif val == 'Idle' %}
Parado
{% elif val == 'Paused' %}
Pausado
{% else %}
{% endif %}
icon_template: >
{% set val = states.vacuum.xiaomi_vacuum_cleaner.attributes.status %}
{% if val == 'Charging' %}
mdi:battery-charging
{% elif val == 'Cleaning' %}
mdi:move-resize
{% elif val == 'Returning home' %}
mdi:keyboard-return
{% elif val == 'Idle' %}
mdi:dots-horizontal
{% elif val == 'Paused' %}
mdi:pause-circle
{% else %}
mdi:help-circle
{% endif %}
# Battery
vacuum_battery:
friendly_name: "Bateria"
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}'
unit_of_measurement: '%'
icon_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_icon }}'
# Cleaned area
vacuum_cleaned_area:
friendly_name: "Área da última limpeza"
unit_of_measurement: 'm²'
entity_id:
- vacuum.xiaomi_vacuum_cleaner
value_template: '{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.cleaned_area }}'
icon_template: 'mdi:ruler'
Para ver como meter o mapa a funcionar, ver este tópico abaixo