Lovelace: Xiaomi Air Purifier card

10

change kitchen_air_purifier with your entity_id of the fan/purifier

sensors.yaml:

- platform: template
  sensors:
      purifier_fan_mode:
         friendly_name: "Mode"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.speed }}"
      purifier_fan_speed:
         friendly_name: "Motor speed"
         unit_of_measurement: 'rpm'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.motor_speed }}"
      purifier_temperature:
         friendly_name: "Temperature"
         unit_of_measurement: 'C°'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.temperature }}"
      purifier_humidity:
         friendly_name: "Humidity"
         unit_of_measurement: '%'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.humidity }}"
      purifier_aqi:
         friendly_name: "Air Quality Index"
         unit_of_measurement: 'aqi'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.aqi }}"
      purifier_favspeed:
         friendly_name: "Favourite Level"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.favorite_level }}"
      purifier_filter_hours_used:
         friendly_name: "Hours Used"
         unit_of_measurement: 'h'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.filter_hours_used }}"
      purifier_filter_life_remaining:
         friendly_name: "Filter"
         unit_of_measurement: '%'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.filter_life_remaining }}"
      purifier_child_lock:
         friendly_name: "Child Lock"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.child_lock }}"
      purifier_display:
         friendly_name: "Display"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.led }}"
      purifier_button_pressed:
         friendly_name: "Button Pressed"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.button_pressed }}"
      purifier_buzzer:
         friendly_name: "Buzzer"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.buzzer }}"
      purifier_filter_type:
         friendly_name: "Filter Type"
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.filter_type }}"
      purifier_ligt_sensor:
         friendly_name: "Light Sensor"
         unit_of_measurement: 'lux'
         value_template: "{{ states.fan.kitchen_air_purifier.attributes.illuminance }}"

Card:

card:
  cards:
    - elements:
        - entity: sensor.purifier_filter_hours_used
          prefix: 'Used: '
          style:
            background-color: 'rgba(0, 0, 0,.0)'
            border-color: 'rgb(34, 154, 210,.0)'
            border-left-style: solid
            color: dodgerblue
            font-size: 100%
            font-weight: bold
            left: 1.5%
            opacity: 1
            pointer-events: none
            top: 5%
            transform: 'translate(0%,-50%)'
          type: state-label
        - icon: 'mdi:water-percent'
          style:
            '--iron-icon-height': 20px
            '--iron-icon-width': 20px
            color: dodgerblue
            left: 8%
            position: absolute
            top: 17%
          tap_action: none
          type: icon
        - entity: sensor.purifier_humidity
          fill: 'rgba(0,0,0,0.3)'
          font_style:
            color: white
          gradient: true
          max: 100
          min: 0
          show_card: null
          stroke_width: 10
          style:
            height: 17%
            left: 15%
            top: 25%
            width: 17%
          type: 'custom:circle-sensor-card'
          units: '%'
        - icon: 'mdi:thermometer'
          style:
            '--iron-icon-height': 20px
            '--iron-icon-width': 20px
            color: dodgerblue
            left: 7.5%
            position: absolute
            top: 37%
          tap_action: none
          type: icon
        - entity: sensor.purifier_temperature
          fill: 'rgba(0,0,0,0.3)'
          font_style:
            color: white
          gradient: true
          max: 50
          min: 0
          show_card: false
          stroke_width: 10
          style:
            height: 17%
            left: 15%
            top: 45%
            width: 17%
          type: 'custom:circle-sensor-card'
          units: °C
        - icon: 'mdi:air-filter'
          style:
            '--iron-icon-height': 17px
            '--iron-icon-width': 17px
            color: dodgerblue
            left: 8%
            top: 56%
          tap_action: none
          type: icon
        - entity: sensor.purifier_filter_life_remaining
          fill: 'rgba(0,0,0,0.3)'
          font_style:
            color: white
          gradient: true
          max: 100
          min: 0
          show_card: false
          stroke_width: 10
          style:
            height: 17%
            left: 15%
            top: 65%
            width: 17%
          type: 'custom:circle-sensor-card'
          units: ''
        - entity: sensor.purifier_aqi
          fill: 'rgba(0,0,0,0.3)'
          font_style:
            color: white
          gradient: true
          max: 600
          min: 0
          show_card: false
          stroke_width: 10
          style:
            height: 13%
            left: 50%
            top: 18.5%
            width: 13%
          type: 'custom:circle-sensor-card'
          units: p
        - icon: 'mdi:speedometer'
          style:
            '--iron-icon-height': 17px
            '--iron-icon-width': 17px
            color: dodgerblue
            left: 8%
            top: 76%
          tap_action: none
          type: icon
        - entity: sensor.purifier_fan_speed
          fill: 'rgba(0,0,0,0.3)'
          font_style:
            color: white
          gradient: true
          max: 1700
          min: 0
          show_card: false
          stroke_width: 10
          style:
            height: 17%
            left: 15%
            top: 85%
            width: 17%
          type: 'custom:circle-sensor-card'
          units: ''
        - entity: sensor.purifier_fan_mode
          max: 2000
          min: 0
          prefix: 'Mode: '
          style:
            background-color: 'rgba(0, 0, 0,.0)'
            border-color: 'rgb(34, 154, 210,.0)'
            border-left-style: solid
            color: dodgerblue
            font-size: 100%
            font-weight: bold
            opacity: 1
            pointer-events: none
            right: 1%
            top: 1%
            transform: none
          type: state-label
        - entity: fan.kitchen_air_purifier
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            margin-right: '-10%'
            right: 17%
            top: 17%
          tap_action:
            action: call-service
            service: fan.toggle
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: state-icon
        - icon: 'mdi:brightness-auto'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            right: 4%
            top: 17%
          tap_action:
            action: call-service
            service: fan.set_speed
            service_data:
              entity_id: fan.kitchen_air_purifier
              speed: Auto
          type: icon
        - icon: 'mdi:power-sleep'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            margin-right: '-10%'
            right: 22%
            top: 34%
          tap_action:
            action: call-service
            service: fan.set_speed
            service_data:
              entity_id: fan.kitchen_air_purifier
              speed: Silent
          type: icon
        - icon: 'mdi:account-heart'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            right: 4%
            top: 34%
          tap_action:
            action: call-service
            service: fan.set_speed
            service_data:
              entity_id: fan.kitchen_air_purifier
              speed: Favorite
          type: icon
        - icon: 'mdi:monitor'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            margin-right: '-10%'
            right: 22%
            top: 51%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_LED_ON
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
        - icon: 'mdi:monitor-off'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            right: 3%
            top: 51%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_LED_OFF
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
        - icon: 'mdi:bell'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            margin-right: '-10%'
            right: 22%
            top: 68%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_BUZZER_ON
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
        - icon: 'mdi:lock-alert'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            margin-right: '-10%'
            right: 22%
            top: 87%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_CHILD_LOCK_ON
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
        - icon: 'mdi:bell-off-outline'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            right: 3%
            top: 68%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_BUZZER_OFF
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
        - icon: 'mdi:lock-open-outline'
          style:
            '--iron-icon-height': 22px
            '--iron-icon-width': 22px
            right: 3%
            top: 87%
          tap_action:
            action: call-service
            service: fan.XIAOMI_MIIO_SET_CHILD_LOCK_OFF
            service_data:
              entity_id: fan.kitchen_air_purifier
          type: icon
      image: /local/xiaomi-mi-air-purifier-2s.jpg
      type: picture-elements
  type: 'custom:vertical-stack-in-card'
style:
  background-image: url("/local/xiaomi-mi-air-purifier-2s.jpg")
  background-repeat: no-repeat
  background-size: 100% 100%
  height: 100%
  position: relative
type: 'custom:card-modder'

Put the following background image in www directory.
Background image:xiaomi-mi-air-purifier-2s

7 Likes