Lovelace Card para aspirador da Xiaomi

Boas malta, vou partilhar o meu card lovelace que usei para configurar o meu aspirador roborock s55. O ficheiro é o “vertical-stack-in-card.js?dl=0”
Entao podem começar por fazer download ao costum card no seguinte link

Devem de meter este ficheiro na pasta www/custom_ui e reiniciam o HA
depois devem de meter também uma imagem na pasta www, eu usei esta a imagem que se encontra no meu git, mas podem usar uma outra que gostem.

depois criei um ficheiro yaml com o seguinte código que está também no git para download porque não consegui meter aqui porque dizia ter demasiados caracteres.

Actualizei o yaml hoje (19-04-2019) para quem quiser usar o modo mopa.
e para o lovelace para quem usa o ui-lovelace.yaml:

resources:
  - type: js
    url: /local/custom_ui/vertical-stack-in-card.js?v=0.1.2
  - title: Xiaomi Robotrock
    icon: mdi:robot-vacuum
    cards:
          - elements:
              - tap_action:
                  action: call-service
                  service: vacuum.locate
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:bell-ring'
                style:
                  color: '#3090C7'
                  left: 80%
                  top: 95%
                type: icon
              - tap_action:
                  action: call-service
                  service: vacuum.clean_spot
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:crosshairs'
                style:
                  color: '#3090C7'
                  left: 68%
                  top: 95%
                type: icon
              - tap_action:
                  action: call-service
                  service: vacuum.return_to_base
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:home'
                style:
                  color: '#3090C7'
                  left: 56%
                  top: 95%
                type: icon
              - tap_action:
                  action: call-service
                  service: vacuum.stop
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:stop'
                style:
                  color: '#3090C7'
                  left: 44%
                  top: 95%
                type: icon
              - tap_action:
                  action: call-service
                  service: vacuum.pause
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:pause'
                style:
                  color: '#3090C7'
                  left: 32%
                  top: 95%
                type: icon
              - tap_action:
                  action: call-service
                  service: vacuum.start
                  service_data:
                    entity_id: vacuum.xiaomi_vacuum_cleaner
                icon: 'mdi:play'
                style:
                  color: '#3090C7'
                  left: 20%
                  top: 95%
                type: icon
             
              - entity: sensor.vacuum_estado
                style:
                  background-color: '#3090C7'
                  border-color: 'rgb(34, 154, 210)'
                  border-radius: 6px
                  color: 'rgb(255, 255, 255)'
                  font-family: Trebuchet MS
                  font-size: 90%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 20%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_estado_aspirador
                prefix: 'Estado: '
                style:
                  border-color: '#3090C7'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 30%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: input_select.zonas_de_aspiracao
                prefix: 'Zona Aspirada: '
                style:
                  border-color: '#3090C7'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 35%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_bateria_aspirador
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 40%
                  transform: 'translate(0%,-50%)'
                type: state-label
              
              - entity: sensor.vacuum_succao_aspirador
                prefix: 'Modo: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 45%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_erro_aspirador
                prefix: 'Existência de Erros: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 50%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_nao_perburbar
                prefix: 'Não Perturbar: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 55%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_nao_perburbar_inicio
                prefix: 'Inicio: '
                style:
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 75%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 60%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_nao_perburbar_fim
                prefix: 'Fim: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 75%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 65%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_ultima_limpeza
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 85%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 70%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_inicio_ultima_limpeza
                prefix: 'Inicio: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 75%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 75%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_fim_ultima_limpeza
                prefix: 'Fim: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 75%
                  font-weight: bold
                  left: 1%
                  pointer-events: none
                  top: 80%
                  transform: 'translate(0%,-50%)'
                type: state-label
            
              - entity: sensor.vacuum_manutencao
                style:
                  background-color: '#3090C7'
                  border-color: 'rgb(34, 154, 210)'
                  border-radius: 6px
                  color: 'rgb(255, 255, 255)'
                  font-family: Trebuchet MS
                  font-size: 90%
                  font-weight: bold
                  pointer-events: none
                  right: 1%
                  top: 10%
                  transform: 'translate(0%,-50%)'
                type: state-label
            
              - entity: vacuum.xiaomi_vacuum_cleaner
                style:
                  background-color: '#cccccc'
                  border-color: 'rgb(34, 154, 210)'
                  border-radius: 6px
                  color: 'rgb(255, 255, 255)'
                  font-family: Trebuchet MS
                  font-size: 130%
                  font-weight: bold
                  right: 38%
                  top: 8%
                  transform: 'translate(0%,-50%)'
                tap_action: more-info
                type: state-label
             
              - entity: sensor.vacuum_escova_principal
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 76%
                  font-weight: bold
                  pointer-events: none
                  right: 1%
                  top: 20%
                  transform: 'translate(0%,-50%)'
                type: state-label
            
              - entity: sensor.vacuum_escova_lateral
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 76%
                  font-weight: bold
                  pointer-events: none
                  right: 1%
                  top: 25%
                  transform: 'translate(0%,-50%)'
                type: state-label
             
              - entity: sensor.vacuum_lavagem_filtro
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 76%
                  font-weight: bold
                  opacity: 0.8
                  pointer-events: none
                  right: 1%
                  top: 30%
                  transform: 'translate(0%,-50%)'
                type: state-label
            
              - entity: sensor.vacuum_limpar_sensores
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 76%
                  font-weight: bold
                  pointer-events: none
                  right: 1%
                  top: 35%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_area_limpa
                prefix: 'Área: '
                style:
                  color: '#84a6ba'
                  font-family: Trebuchet MS
                  font-size: 80%
                  font-weight: bold
                  left: 30%
                  pointer-events: none
                  top: 85%
                  transform: 'translate(0%,-50%)'
                type: state-label
              
              - entity: sensor.vacuum_tempo_aspiraccao
                prefix: 'Tempo: '
                style:
                  color: '#84a6ba'
                  font-family: Trebuchet MS
                  font-size: 80%
                  font-weight: bold
                  left: 51%
                  pointer-events: none
                  top: 85%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_estado_geral
                style:
                  background-color: '#3090C7'
                  border-color: 'rgb(34, 154, 210)'
                  border-radius: 6px
                  color: 'rgb(255, 255, 255)'
                  font-family: Trebuchet MS
                  font-size: 90%
                  font-weight: bold
                  pointer-events: none
                  right: 1%
                  top: 50%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_area_limpeza_total
                prefix: 'Área Total Limpa: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 70%
                  font-weight: bold
                  right: 1%
                  pointer-events: none
                  top: 60%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_tempo_limpeza_total
                prefix: 'Tempo Total Limpeza: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 70%
                  font-weight: bold
                  right: 1%
                  pointer-events: none
                  top: 65%
                  transform: 'translate(0%,-50%)'
                type: state-label

              - entity: sensor.vacuum_limpeza_total
                prefix: 'Total Limpezas: '
                style:
                  border-color: 'rgb(34, 154, 210)'
                  color: '#ffffff'
                  font-family: Trebuchet MS
                  font-size: 70%
                  font-weight: bold
                  right: 1%
                  pointer-events: none
                  top: 70%
                  transform: 'translate(0%,-50%)'
                type: state-label

            image: /local/s50.jpg
            title: RoboRock S55
            type: picture-elements

          - type: vertical-stack
            cards:
              - type: entities
                entities:
                  - entity: input_select.estados_de_succao
              - type: entities
                title: Aspirar por zonas
                entities:
                  - input_select.zonas_de_aspiracao

e para quem usa a ui do HA está aqui

resources:
  - type: js
    url: /local/custom_ui/vertical-stack-in-card.js?v=0.1.2

  - badges: []
    cards:
      - elements:
          - icon: 'mdi:bell-ring'
            style:
              color: '#ffffff'
              left: 80%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.locate
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - icon: 'mdi:crosshairs'
            style:
              color: '#ffffff'
              left: 68%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.clean_spot
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - icon: 'mdi:home'
            style:
              color: '#ffffff'
              left: 56%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.return_to_base
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - icon: 'mdi:stop'
            style:
              color: '#ffffff'
              left: 44%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.stop
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - icon: 'mdi:pause'
            style:
              color: '#ffffff'
              left: 32%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.pause
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - icon: 'mdi:play'
            style:
              color: '#ffffff'
              left: 20%
              top: 95%
            tap_action:
              action: call-service
              service: vacuum.start
              service_data:
                entity_id: vacuum.xiaomi_vacuum_cleaner
            type: icon
          - entity: sensor.vacuum_estado
            style:
              background-color: '#3090C7'
              border-color: 'rgb(34, 154, 210)'
              border-radius: 6px
              color: 'rgb(255, 255, 255)'
              font-family: Trebuchet MS
              font-size: 90%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 20%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_estado_aspirador
            prefix: 'Estado: '
            style:
              border-color: '#3090C7'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 30%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: input_select.zonas_de_aspiracao
            prefix: 'A Aspirar: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 35%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_bateria_aspirador
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 40%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_succao_aspirador
            prefix: 'Modo: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 45%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_erro_aspirador
            prefix: 'Existência de Erros: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 50%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_nao_perburbar
            prefix: 'Não Perturbar: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 55%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_nao_perburbar_inicio
            prefix: 'Inicio: '
            style:
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 75%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 60%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_nao_perburbar_fim
            prefix: 'Fim: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 75%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 65%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_ultima_limpeza
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 85%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 70%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_inicio_ultima_limpeza
            prefix: 'Inicio: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 75%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 75%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_fim_ultima_limpeza
            prefix: 'Fim: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 75%
              font-weight: bold
              left: 1%
              pointer-events: none
              top: 80%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_manutencao
            style:
              background-color: '#3090C7'
              border-color: 'rgb(34, 154, 210)'
              border-radius: 6px
              color: 'rgb(255, 255, 255)'
              font-family: Trebuchet MS
              font-size: 90%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 10%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: vacuum.xiaomi_vacuum_cleaner
            style:
              background-color: '#cccccc'
              border-color: 'rgb(34, 154, 210)'
              border-radius: 6px
              color: 'rgb(255, 255, 255)'
              font-family: Trebuchet MS
              font-size: 130%
              font-weight: bold
              right: 38%
              top: 8%
              transform: 'translate(0%,-50%)'
            tap_action:
              action: more-info
            type: state-label
          - entity: sensor.vacuum_escova_principal
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 76%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 20%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_escova_lateral
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 76%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 25%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_lavagem_filtro
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 76%
              font-weight: bold
              opacity: 0.8
              pointer-events: none
              right: 1%
              top: 30%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_limpar_sensores
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 76%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 35%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_area_limpa
            prefix: 'Área: '
            style:
              color: '#336A93'
              font-family: Trebuchet MS
              font-size: 80%
              font-weight: bold
              left: 30%
              pointer-events: none
              top: 85%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_tempo_aspiraccao
            prefix: 'Tempo: '
            style:
              color: '#336A93'
              font-family: Trebuchet MS
              font-size: 80%
              font-weight: bold
              left: 51%
              pointer-events: none
              top: 85%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_estado_geral
            style:
              background-color: '#3090C7'
              border-color: 'rgb(34, 154, 210)'
              border-radius: 6px
              color: 'rgb(255, 255, 255)'
              font-family: Trebuchet MS
              font-size: 90%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 50%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_area_limpeza_total
            prefix: 'Área Total Limpa: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 70%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 60%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_tempo_limpeza_total
            prefix: 'Tempo Total Limpeza: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 70%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 65%
              transform: 'translate(0%,-50%)'
            type: state-label
          - entity: sensor.vacuum_limpeza_total
            prefix: 'Total Limpezas: '
            style:
              border-color: 'rgb(34, 154, 210)'
              color: '#09f9ed'
              font-family: Trebuchet MS
              font-size: 70%
              font-weight: bold
              pointer-events: none
              right: 1%
              top: 70%
              transform: 'translate(0%,-50%)'
            type: state-label
        image: /local/s50.jpg
        title: RoboRock S55
        type: picture-elements
      - cards:
          - entities:
              - entity: input_select.estados_de_succao
            type: entities
          - entities:
              - input_select.zonas_de_aspiracao
            title: Aspirar por zonas
            type: entities
        type: vertical-stack
      - cards:
          - entities:
              - automation.aspirar_quando_nao_esta_ninguem_em_casa
            type: glance
        type: horizontal-stack
    icon: 'mdi:robot-vacuum'
    path: Xiaomi Vaccum Clean
    title: Xiaomi Vaccum

Espero que seja do vosso agrado.

4 Likes

Muito obrigado pela partilha! :+1:

2 Likes

Obrigado pela partilha, ficou espetacular!
No entanto, não estou a conseguir por isto a dar…
As minhas duvidas/questões:
-Onde devo colocar o ficheiro xiaomi_vacumm.yaml?
-No final, como é que eu adiciono o card? È suposto aparecer automaticamente no dashboard?

Para começar tens de ter o packages. É lá que colocas o ficheiro. Quanto aos cards tens os códigos todos em cima é só adicionar no lovelace.


Copyright © 2017-2020. Todos os direitos reservados
CPHA.pt - info@cpha.pt


FAQ | Termos de Serviço/Regras | Política de Privacidade