Lovelace: Xiaomi - Mi air purifier 3H card

Update:

I see in this topic a lot of different versions of configuration,yaml, automation.yaml, scripts.yaml and so on and on.

It’s also that i need to add the purifier first with the xiaomi miot integration? Or can i just add the info what i got with this bash script in Linux???

bash <(curl -L https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/raw/master/run.sh)

Is it maybe a idea to centralize the latest versions of all the files in the startpost or something? Thank you :slight_smile:

1 Like

I’d suggest using the official integration, as it has the token extraction built in. And it will work with more of the configurations listed here.

And it’s a good idea to centralize the variations. But I am not sure whose responsibility it would be to maintain.

1 Like

@Razer @maker3 @bjorn.sivertsen

I preferred the older Xiaomi-smoothened AQI values except at low AQIs (<10 or 20) when it would update less often.

Since the realtime AQI update PR has merged, the data from the sensor is a lot more noisy now since it lacks the smoothening filters.

Purely the visualisation?

Just use mini graph card to smoothen it out.

Becomes

I agree that visually that I want the second picture, but I want my automations to act on the raw data.

I saw your issue report, but didn’t have time to respond earlier.
I already replied Reverse change to AQI value polling from air purifier · Issue #1387 · rytilahti/python-miio (github.com)

Smoothening should be done in postpressing, not during data collecting.
Seems like you are looking for moving average.
I never used it, but HA has something like: time_simple_moving_average.

Please remove your pull request, until someone accidentaly merge it.

1 Like

I have after some struggle a little progress. But now i got when in press a button the message: service fan/speed not found. But what i read is this service deleted from HA what i read here:

Does someone have a solution for not using ‘‘fan/speed’’ ?

Post your dashboard code :blush:

1 Like

Here it comes. First screenshot of it now looks:

afbeelding

The dashboard code i got now:

type: picture-elements
image: local/mi_air_purifier_3h.png
elements:
  - type: conditional
    conditions:
      - entity: sensor.mi_air_purifier_3_3h_pm2_5
        state: clean
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
        state: 'off'
    elements:
      - type: image
        entity: sensor.mi_air_purifier_3_3h_pm2_5
        title: PM2.5 severity level
        tap_action:
          action: more-info
        state_image:
          clean: local/mi_air_purifier_3h_clean.png
        style:
          top: 34%
          left: 69%
  - type: conditional
    conditions:
      - entity: sensor.mi_air_purifier_3_3h_pm2_5
        state: polluted
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
        state: 'off'
    elements:
      - type: image
        entity: sensor.mi_air_purifier_3_3h_pm2_5
        title: PM2.5 severity level
        tap_action:
          action: more-info
        state_image:
          polluted: local/mi_air_purifier_3h_polluted.png
        style:
          top: 34%
          left: 69%
  - type: conditional
    conditions:
      - entity: sensor.mi_air_purifier_3_3h_pm2_5
        state: critical
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
        state: 'off'
    elements:
      - type: image
        entity: sensor.mi_air_purifier_3_3h_pm2_5
        title: PM2.5 severity level
        tap_action:
          action: more-info
        state_image:
          critical: local/mi_air_purifier_3h_critical.png
        style:
          top: 34%
          left: 69%
  - type: state-icon
    entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
    title: 'Off'
    icon: mdi:power-standby
    tap_action:
      action: call-service
      service: fan.turn_off
      service_data:
        entity_id: fan.mi_air_purifier_3_3h
    style:
      top: 1%
      left: 6%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(128, 128, 128)
      '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: state-icon
    entity: fan.mi_air_purifier_3_3h
    title: More Info
    icon: mdi:dots-vertical
    tap_action:
      action: more-info
    style:
      top: 1%
      left: 36%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(128, 128, 128)
      '--paper-item-icon-active-color': rgb(128, 128, 128)
  - type: conditional
    conditions:
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
        state: 'off'
    elements:
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_pm2_5
        title: PM2.5
        tap_action:
          action: more-info
        style:
          top: 19%
          left: 68.5%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 400%
          transform: translate(-50%, 0)
          color: rgb(255,255,255)
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_temperature
        title: Temperature
        tap_action:
          action: more-info
        style:
          top: 32%
          left: 64%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 75%
          transform: translate(-50%, 0)
          color: rgb(255,255,255)
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_humidity
        title: Humidity
        tap_action:
          action: more-info
        style:
          top: 32%
          left: 71%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 75%
          transform: translate(-50%, 0)
          color: rgb(255,255,255)
      - type: state-icon
        entity: select.mi_air_purifier_3_3h_led_brightness
        title: Display
        tap_action:
          action: toggle
        style:
          top: 15%
          left: 36%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(128, 128, 128)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: state-icon
        entity: switch.mi_air_purifier_3_3h_buzzer
        title: Buzzer
        tap_action:
          action: toggle
        style:
          top: 29%
          left: 36%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(128, 128, 128)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: state-icon
        entity: switch.mi_air_purifier_3_3h_child_lock
        title: Child lock
        tap_action:
          action: toggle
        style:
          top: 1%
          left: 26%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(128, 128, 128)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_filter_life_remaining
        title: Filter remaining
        tap_action:
          action: more-info
        style:
          top: 10%
          left: 92%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 80%
          color: rgb(128,128,128)
  - type: conditional
    conditions:
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_on
        state: 'on'
    elements:
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_pm2_5
        title: PM2.5
        tap_action:
          action: more-info
        style:
          top: 19%
          left: 68.5%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 400%
          transform: translate(-50%, 0)
          color: rgb(128, 128, 128)
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_temperature
        title: Temperature
        tap_action:
          action: more-info
        style:
          top: 32%
          left: 64%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 75%
          transform: translate(-50%, 0)
          color: rgb(128, 128, 128)
      - type: state-label
        entity: sensor.mi_air_purifier_3_3h_humidity
        title: Humidity
        tap_action:
          action: more-info
        style:
          top: 32%
          left: 71%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 75%
          transform: translate(-50%, 0)
          color: rgb(128, 128, 128)
  - type: state-icon
    entity: binary_sensor.mi_air_purifier_3_3h_mode_auto
    title: Auto
    icon: mdi:autorenew
    tap_action:
      action: call-service
      service: fan.set_speed
      service_data:
        entity_id: fan.mi_air_purifier_3_3h
        speed: Auto
    style:
      top: 50%
      left: 6%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(192, 192, 192)
      '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: state-icon
    entity: number.mi_air_purifier_3_3h_fan_level
    title: 1
    icon: mdi:power-sleep
    tap_action:
      action: call-service
      service: fan.set_speed
      service_data:
        entity_id: fan.mi_air_purifier_3_3h
        speed: Silent
    style:
      top: 50%
      left: 16%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(192, 192, 192)
      '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: state-icon
    entity: number.mi_air_purifier_3_3h_fan_level
    title: 2
    icon: mdi:fan
    tap_action:
      action: call-service
      service: fan.set_speed
      service_data:
        entity_id: fan.mi_air_purifier_3_3h
        speed: Fan
    style:
      top: 50%
      left: 26%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(192, 192, 192)
      '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: state-icon
    entity: binary_sensor.mi_air_purifier_3_3h_mode_favorite
    title: Favorite
    icon: mdi:heart
    tap_action:
      action: call-service
      service: fan.set_speed
      service_data:
        entity_id: fan.mi_air_purifier_3_3h
        speed: Favorite
    style:
      top: 50%
      left: 36%
      transform: translate(-50%, 0)
      '--paper-item-icon-color': rgb(192, 192, 192)
      '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: conditional
    conditions:
      - entity: binary_sensor.mi_air_purifier_3_3h_mode_fan
        state: 'on'
    elements:
      - type: state-icon
        entity: number.mi_air_purifier_3_3h_fan_level
        title: Fan level 1
        icon: mdi:fan-speed-1
        tap_action:
          action: call-service
          service: number.mi_air_purifier_3_3h_fan_level
          service_data:
            entity_id: number.mi_air_purifier_3_3h_fan_level
            level: 1
        style:
          top: 64%
          left: 11%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(192, 192, 192)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: state-icon
        entity: number.mi_air_purifier_3_3h_fan_level
        title: Fan level 2
        icon: mdi:fan-speed-2
        tap_action:
          action: call-service
          service: number.mi_air_purifier_3_3h_fan_level
          service_data:
            entity_id: number.mi_air_purifier_3_3h_fan_level
            level: 2
        style:
          top: 64%
          left: 21%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(192, 192, 192)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: state-icon
        entity: number.mi_air_purifier_3_3h_fan_level
        title: Fan level 3
        icon: mdi:fan-speed-3
        tap_action:
          action: call-service
          service: number.mi_air_purifier_3_3h_fan_level
          service_data:
            entity_id: number.mi_air_purifier_3_3h_fan_level
            level: 3
        style:
          top: 64%
          left: 31%
          transform: translate(-50%, 0)
          '--paper-item-icon-color': rgb(192, 192, 192)
          '--paper-item-icon-active-color': rgb(255, 128, 0)
  - type: conditional
    conditions:
      - entity: number.mi_air_purifier_3_3h_favorite_level
        state: '14'
    elements:
      - type: state-label
        entity: number.mi_air_purifier_3_3h_favorite_level
        title: Favorite level
        tap_action:
          action: none
        style:
          top: 64%
          left: 21%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 200%
          transform: translate(-50%, 0)
          color: rgb(255, 128, 0)
      - type: icon
        icon: mdi:plus
        title: Favorite level +
        tap_action:
          action: call-service
          service: script.favorite_up
          service_data:
            entity_id: number.mi_air_purifier_3_3h_favorite_level
            step: 1
        style:
          top: 66%
          left: 30%
          min-width: 40px
          min-height: 40px
          transform: translate(-50%, 0)
          color: rgb(192, 192, 192)
          color_off: rgb(255, 128, 0)
      - type: icon
        icon: mdi:minus
        title: Favorite level -
        tap_action:
          action: call-service
          service: script.favorite_down
          service_data:
            entity_id: number.mi_air_purifier_3_3h_favorite_level
            step: 1
        style:
          top: 66%
          left: 16%
          min-width: 40px
          min-height: 40px
          transform: translate(-50%, 0)
          color: rgb(192, 192, 192)
          color_off: rgb(255, 128, 0)
      - type: state-label
        entity: input_select.mi_air_purifier_coverage
        title: Coverage
        tap_action:
          action: none
        style:
          top: 74%
          left: 23%
          min-width: 40px
          min-height: 40px
          text-align: center
          font-size: 100%
          transform: translate(-50%, 0)
          color: rgb(255, 128, 0)

And the entities the are available. Strange enough begin all entities with “mi_air_purifier_3_3h_”. And also there are some entities not available to change?

Thank you for any help! :slight_smile:

Hi,

Here’s some cleaned up and working config at 25/04/22 with official Xiaomi Miio integration, that’s how it looks in Spanish (the code in the post has visual names translated to English):

ezgif-2-e7d7a5ecff

  1. Configure your device as normal with the official Xiaomi Miio integration using IP and token

  2. Install THIS CUSTOM CARD through HACS or manually (read instructions on the linked github)

  3. Add custom card from code (that one is for Mi Purifier 3H, edit or adapt it for your device):

type: custom:purifier-card
entity: fan.zhimi_airpurifier_mb3
aqi:
  entity_id: sensor.zhimi_airpurifier_mb3_pm2_5
  unit: µg/m³
stats:
  - entity_id: sensor.zhimi_airpurifier_mb3_motor_speed
    unit: RPM
    subtitle: Speed
  - entity_id: sensor.zhimi_airpurifier_mb3_temperature
    unit: ºC
    subtitle: Temperature
  - entity_id: sensor.zhimi_airpurifier_mb3_humidity
    unit: '%'
    subtitle: Humidity
  - entity_id: sensor.zhimi_airpurifier_mb3_filter_life_remaining
    subtitle: Filter
    unit: '%'
actions:
  - name: Silent
    icon: mdi:weather-night
    preset_mode: Silent
  - name: 25%
    icon: mdi:circle-slice-2
    preset_mode: Favorite
    number.zhimi_airpurifier_mb3_favorite_level: 3
  - name: 50%
    icon: mdi:circle-slice-4
    preset_mode: Favorite
    number.zhimi_airpurifier_mb3_favorite_level: 7
  - name: 75%
    icon: mdi:circle-slice-6
    preset_mode: Favorite
    number.zhimi_airpurifier_mb3_favorite_level: 10
  - name: 100%
    icon: mdi:circle-slice-8
    preset_mode: Favorite
    number.zhimi_airpurifier_mb3_favorite_level: 14
  - name: Auto
    icon: mdi:refresh-auto
    preset_mode: Auto
shortcuts:
  - name: Silent
    icon: mdi:weather-night
    preset_mode: Silent
  - name: 25%
    icon: mdi:circle-slice-2
    percentage: 25
  - name: 50%
    icon: mdi:circle-slice-4
    percentage: 50
  - name: 75%
    icon: mdi:circle-slice-6
    percentage: 100
  - name: Auto
    icon: mdi:refresh-auto
    preset_mode: Auto
show_name: true
show_status: true
show_state: true
show_toolbar: true
compact_view: false
  1. Here’s my automations.yaml (descriptions are pretty self-explanatory):
- id: '1234567891011'
  alias: AP01 - Air Purifier turn on
  description: Automatically turns on purifier on Favorite when >15 for +30s, only
    when it's OFF
  trigger:
  - platform: time_pattern
    minutes: /1
  condition:
  - condition: device
    device_id: 62ff38a78452b62f71afd27c306bae6c
    domain: fan
    entity_id: fan.zhimi_airpurifier_mb3
    type: is_off
  - type: is_pm25
    condition: device
    device_id: 62ff38a78452b62f71afd27c306bae6c
    entity_id: sensor.zhimi_airpurifier_mb3_pm2_5
    domain: sensor
    above: 15
  action:
  - data:
      preset_mode: Favorite
    service: fan.turn_on
    target:
      entity_id: fan.zhimi_airpurifier_mb3
  mode: restart
- id: '1234567891012'
  alias: AP03 - Air Purifier set favorite level based on PM2.5
  description: Automatically changes Favorite level every 15s based on PM2.5, only
    when it's ON
  trigger:
  - platform: time_pattern
    seconds: /30
  condition:
  - condition: device
    device_id: 62ff38a78452b62f71afd27c306bae6c
    domain: fan
    entity_id: fan.zhimi_airpurifier_mb3
    type: is_on
  - condition: and
    conditions:
    - condition: state
      entity_id: automation.ap01_air_purifier_turn_on
      state: 'on'
  action:
  - service: fan.set_preset_mode
    target:
      entity_id: fan.zhimi_airpurifier_mb3
    data:
      preset_mode: Favorite
  - service: number.set_value
    entity_id: number.zhimi_airpurifier_mb3_favorite_level
    data_template:
      value: "{% if states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0) > 500 %}\n\
        \  10\n{% elif states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0) > 400\
        \ %}\n  9\n{% elif states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0) >\
        \ 300 %}\n  8\n{% elif states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0)\
        \ > 200 %}\n  7\n{% elif states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0)\
        \ > 100 %}\n  6\n{% elif states('sensor.zhimi_airpurifier_mb3_pm2_5') | int(0)\
        \ > 10 %}\n  5\n{% else %}\n  4\n{% endif %}\n"
  mode: restart
- id: '1234567891013'
  alias: AP03 - Air Purifier turn off
  description: Automatically turns off purifier when <5 for +30s, only when it's ON
  trigger:
  - platform: time_pattern
    minutes: /1
  condition:
  - condition: device
    device_id: 62ff38a78452b62f71afd27c306bae6c
    domain: fan
    entity_id: fan.zhimi_airpurifier_mb3
    type: is_on
  - type: is_pm25
    condition: device
    device_id: 62ff38a78452b62f71afd27c306bae6c
    entity_id: sensor.zhimi_airpurifier_mb3_pm2_5
    domain: sensor
    below: 5
  action:
  - data: {}
    entity_id: fan.zhimi_airpurifier_mb3
    service: fan.turn_off
  mode: restart

Hope it helps :wink:

Only problem I currently have is that I get timeouts when fetching data from the purifier every few minutes, hopefully someone can shred some light on this @schilea :

2022-04-26 00:53:00 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching Mi Air Purifier 3/3H data
1 Like

@schilea this is your implementation of the card, do you mind posting your latest config?

Hi guys, been on holydays for few days and today back to work. There is no problem for me to post all the new relevant card implementations, mine included, and I can add an link in my first post for them. Just let me know what and when.

Hi @schilea, do you know how can I fix the fetching timeouts?

2022-04-26 00:53:00 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching Mi Air Purifier 3/3H data

Hi, I think is a miio issue and you have to raise a ticket. It has nothing to do with the card, rather with the implementation

@ssergiio check this Timeout fetching data in Xiaomi Miio · Issue #59215 · home-assistant/core · GitHub

@schilea yeah I saw it and installed the custom component but can’t figure out how to use it… The component is installed and I add the fan to my configurations.yaml but entities/device aren’t being showed

Minimalistic Purifier Card
My approach for the card is a bit different, as I try not to have pictures of devices in my dashboard.
So currently it looks like this:

Auto-mode enabled
image

Fan mode enabled
image

Functionality
I have removed all the details, that I do not think I need at a quick glance.
And relevant information appears or disappears when appropriate.

Custom Cards Needed

  1. custom-cards/stack-in-card: :hammer_and_wrench: group multiple cards into one card without the borders (github.com)
  2. kalkih/mini-graph-card: Minimalistic graph card for Home Assistant Lovelace UI (github.com)

Prior configuration needed

  1. Integration

I use the official integration for Miio, and suggest you do the same, as it exposes the necessary entities for this card, combined with some template sensors you define yourself, see below:

  1. Template sensors

You need some template sensors configured, which are the following, remember to change device name to the one you got:

configuration.yaml

template:
  - binary_sensor:
      - name: bedroom_purifier_mode_silent
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Silent' }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_favorite
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Favorite' }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_fan
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Fan' }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_fan_1'
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Fan' and is_state('number.bedroomair_purifier_fan_level', '1') }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_fan_2
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Fan' and is_state('number.bedroomair_purifier_fan_level', '2') }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_fan_3
        state: "{{ state_attr('fan.bedroom_purifier', 'preset_mode') ==  'Fan' and is_state('number.bedroomair_purifier_fan_level', '3') }}"
  - binary_sensor:
      - name: bedroom_purifier_mode_off
        state: "{{ is_state('fan.bedroom_purifier', 'off') }}"
  1. Background picture

Download the below empty image, and place it in the folder config/www/
AP-Card-Background2
Right click above here and save as picture

Automations
I have multiple automations in use, but the only one that I think is very important, is the changed automode, which only triggers when the purifier is in favorite mode and turned on. Then it will change favorite level depending on the measured 2.5PM value on a much more aggresive manner than the one built in, which is more suited for places with very bad air quality, like Chinese cities.

- id: '1234567891012'
  alias: AP02 - Air Purifier set favorite level based on PM2.5
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: state
    entity_id: fan.bedroom_purifier
    state: Favorite
    attribute: preset_mode
  - condition: state
    entity_id: fan.bedroom_purifier
    state: 'on'
  action:
  - service: fan.set_preset_mode
    target:
      entity_id: fan.bedroom_purifier
    data:
      preset_mode: Favorite
  - service: number.set_value
    entity_id: number.bedroom_purifier_favorite_level
    data_template:
      value: "{% if states('sensor.bedroomair_purifier_pm2_5') | int > 140 %}\n  14\n\
        {% elif states('sensor.bedroomair_purifier_pm2_5') | int > 120 %}\n  12\n\
        {% elif states('sensor.bedroomair_purifier_pm2_5') | int > 100 %}\n  10\n\
        {% elif states('sensor.bedroomair_purifier_pm2_5') | int > 80 %}\n  8\n{%\
        \ elif states('sensor.bedroomair_purifier_pm2_5') | int > 60 %}\n  6\n{% elif\
        \ states('sensor.bedroomair_purifier_pm2_5') | int > 40 %}\n  4\n{% elif states('sensor.bedroomair_purifier_pm2_5')\
        \ | int > 20 %}\n  3\n{% elif states('sensor.bedroomair_purifier_pm2_5') |\
        \ int > 10 %}\n  2\n{% else %}\n  1\n{% endif %}\n"

Dashboard Card

Below is the yaml code for the actual card, that you place in a manual card. Make sure that the device name fits the one you have you.

type: custom:stack-in-card
cards:
  - type: vertical-stack
    cards:
      - type: picture-elements
        image: local/AP-Card-Background.png
        title: Bedroom Air Purifier
        elements:
          - type: state-label
            prefix: 'Filter Left '
            entity: sensor.bedroomair_purifier_filter_life_remaining
            style:
              top: 90%
              left: 85%
          - type: state-icon
            entity: binary_sensor.bedroom_purifier_mode_off
            title: 'Off'
            icon: mdi:power-standby
            tap_action:
              action: call-service
              service: fan.toggle
              service_data:
                entity_id: fan.bedroom_purifier
            style:
              top: 0%
              left: 90%
              min-width: 40px
              min-height: 40px
              transform: translate(-50%, -50%) scale(1.5)
              '--paper-item-icon-color': rgb(192, 192, 192)
              '--paper-item-icon-active-color': rgb(255, 128, 0)
          - type: state-icon
            entity: binary_sensor.bedroom_purifier_mode_favorite
            title: Auto
            icon: mdi:autorenew
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.bedroom_purifier
                preset_mode: Favorite
            style:
              top: 0%
              left: 10%
              transform: translate(-50%, -50%) scale(1.5)
              '--paper-item-icon-color': rgb(192, 192, 192)
              '--paper-item-icon-active-color': rgb(255, 128, 0)
          - type: state-icon
            entity: binary_sensor.bedroom_purifier_mode_silent
            title: Silent
            icon: mdi:power-sleep
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.bedroom_purifier
                preset_mode: Silent
            style:
              top: 0%
              left: 63.34%
              transform: translate(-50%, -50%) scale(1.5)
              '--paper-item-icon-color': rgb(192, 192, 192)
              '--paper-item-icon-active-color': rgb(255, 128, 0)
              '--iron-icon-height': 120px
              '--iron-icon-width': 120px
          - type: state-icon
            entity: binary_sensor.bedroom_purifier_mode_fan
            title: Fan
            icon: mdi:fan
            tap_action:
              action: call-service
              service: number.set_value
              service_data:
                entity_id: number.bedroomair_purifier_fan_level
                value: 1
            style:
              top: 0%
              left: 36.67%
              transform: translate(-50%, -50%) scale(1.5)
              '--paper-item-icon-color': rgb(192, 192, 192)
              '--paper-item-icon-active-color': rgb(255, 128, 0)
          - type: conditional
            conditions:
              - entity: binary_sensor.bedroom_purifier_mode_favorite
                state: 'on'
            elements:
              - type: state-label
                prefix: 'Level '
                entity: number.bedroom_purifier_favorite_level
                style:
                  top: 50%
                  left: 11.5%
                  font-size: 150%
          - type: conditional
            conditions:
              - entity: binary_sensor.bedroom_purifier_mode_fan
                state: 'on'
            elements:
              - type: state-icon
                entity: binary_sensor.bedroom_purifier_mode_fan_1
                title: Fan level 1
                icon: mdi:fan-speed-1
                tap_action:
                  action: call-service
                  service: number.set_value
                  service_data:
                    entity_id: number.bedroomair_purifier_fan_level
                    value: 1
                style:
                  top: 70%
                  left: 29.67%
                  transform: translate(-50%, -50%) scale(1.2, 1.2)
                  '--paper-item-icon-color': rgb(192, 192, 192)
                  '--paper-item-icon-active-color': rgb(255, 128, 0)
              - type: state-icon
                entity: binary_sensor.bedroom_purifier_mode_fan_2
                title: Fan level 2
                icon: mdi:fan-speed-2
                tap_action:
                  action: call-service
                  service: number.set_value
                  service_data:
                    entity_id: number.bedroomair_purifier_fan_level
                    value: 2
                style:
                  top: 70%
                  left: 36.37%
                  transform: translate(-50%, -50%) scale(1.2, 1.2)
                  '--paper-item-icon-color': rgb(192, 192, 192)
                  '--paper-item-icon-active-color': rgb(255, 128, 0)
              - type: state-icon
                entity: binary_sensor.bedroom_purifier_mode_fan_3
                title: Fan level 3
                icon: mdi:fan-speed-3
                tap_action:
                  action: call-service
                  service: number.set_value
                  service_data:
                    entity_id: number.bedroomair_purifier_fan_level
                    value: 3
                style:
                  top: 70%
                  left: 43.67%
                  transform: translate(-50%, -50%) scale(1.2, 1.2)
                  '--paper-item-icon-color': rgb(192, 192, 192)
                  '--paper-item-icon-active-color': rgb(255, 128, 0)
      - type: custom:mini-graph-card
        entities:
          - sensor.bedroomair_purifier_pm2_5
        points_per_hour: 3
        animate: true
        show:
          icon: false
          name: false
          state: true

7 Likes

You can link to 336 for my rendition

Done, check the 1st post

1 Like

Nice card…

Can someone please confirm if I could use same integration for 3C model instead of 3H?