Lovelace: Xiaomi - Mi air purifier 3H card

I think I did it. Thanks :slight_smile:
Regards.

I followed the instruction - but I have double ā€˜Unknownā€™ on the display.
What could be wrong?

are the temperature and humidity sensors defined?

O.K. Iā€™ve copied wrong (eariler) configuration dataā€¦
Now replaced with code from Septemberā€¦
But not sure why I see the four triangles with !..
Checked the code, but could not find the reasonā€¦

I think it would be quite helpful if you posted the lovelace code, and then the full name of all relevant entities.

Looks like simple reference errors.

Yes, anyway Iā€™ve made further corrections - looks much betterā€¦
But when the favorites icon is clicked - I see something like that.
So still something missedā€¦
Indeed entity ā€˜input_select.mi_air_purifier_3h_coverageā€™ is not on the list of available entities.
So some code still missedā€¦

First, update your configuration with the one from post 239. Is the latest one considering template. Also add just the input_select definition from my scripts to you config file.

1 Like

Yes, my faultā€¦ I missed some posts. Now corrected.
Still 1 more question - when I click the ā€˜heartā€™ sign the values are changing from 1.0 to 10.0 or moreā€¦
But nothing is changing below - i.e. square meters are the same always 2-4m2.

somehow Iā€™ve exactly the same issue, squares are not changing, it was working fine before

i tried to troubleshoot but found nothing

I think there is something with the automation/scripts.

I fixed it few weeks ago but unfortunately my HA crashed yesterday so I had to reconfigured again almost everything because my latest saved backup was from 2 month ago.

I had to do a lot of work to update HA to the latest config (templates in config etc,missing entities, addons) and now solved almost everything except purifier that is currently not working.

@Posreg @dariusz

Check that you have:

  1. configuration
#======================#
#  Mi Air Purifier 3H  #
#======================#
input_select:
    mi_air_purifier_3h_coverage:
      name: Coverage
      options:
        - 2-4 mĀ²
        - 5-9 mĀ²
        - 7-12 mĀ²
        - 12-22 mĀ²
        - 14-24 mĀ²
        - 14-25 mĀ²
        - 16-27 mĀ²
        - 17-30 mĀ²
        - 18-32 mĀ²
        - 19-33 mĀ²
        - 20-34 mĀ²
        - 22-38 mĀ²
        - 23-40 mĀ²
        - 26-45 mĀ²
        - 28-49 mĀ²
      icon: mdi:texture-box
  1. automation
- id: '1234567891014'
  alias: AP04 - Air Purifier favorite level to coverage
  description: ''
  trigger:
  - platform: state
    entity_id: number.mi_air_purifier_3h_favorite_level
  condition: []
  action:
  - service: input_select.set_options
    entity_id: input_select.mi_air_purifier_3h_coverage
    data:
      options: '{% if states("number.mi_air_purifier_3h_favorite_level") | int ==
        0 -%} 2-4 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level") |
        int == 1 -%} 5-9 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 2 -%} 7-12 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 3 -%} 12-22 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 4 -%} 14-24 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 5 -%} 14-25 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 6 -%} 16-27 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 7 -%} 17-30 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 8 -%} 18-32 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 9 -%} 19-33 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 10 -%} 20-34 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 11 -%} 22-38 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 12 -%} 23-40 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 13 -%} 26-45 mĀ² {%- elif states("number.mi_air_purifier_3h_favorite_level")
        | int == 14 -%} 28-49 mĀ² {%- else -%} {%- endif %}'
  mode: single

this was it, Iā€™ve simply overlooked the fact that I was referring to the old combination (entity + attribute)


  alias: AP04 - Air Purifier favorite level to coverage
  description: ''
  trigger:
  - entity_id: fan.mi_air_purifier_3h
    attribute: favorite_level
    platform: state
  condition: []
  action:
  - data:
      option: '{% if is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        0) -%} 2-4 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        1) -%} 5-9 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        2) -%} 7-12 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        3) -%} 12-22 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        4) -%} 14-24 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        5) -%} 14-25 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        6) -%} 16-27 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        7) -%} 17-30 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        8) -%} 18-32 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        9) -%} 19-33 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        10) -%} 20-34 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        11) -%} 22-38 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        12) -%} 23-40 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        13) -%} 26-45 mĀ² {%- elif is_state_attr(''fan.mi_air_purifier_3h'',''favorite_level'',
        14) -%} 28-49 mĀ² {%- else -%} {%- endif %}'
    entity_id: input_select.mi_air_purifier_3h_coverage
    service: input_select.select_option

thank you and sorry, I should have spot that :smiley: :roll_eyes:

O.K. I corrected that - now better. Square meters are changing alsoā€¦

However there is still 1 small issueā€¦ When I open the card, the value is shown without point (i.e. 13).
But when I start changing that value (with + or -) it is shown with point (ex. 14.0).
See pictures what I meanā€¦

1 Like

That has something to do with the integration, when they introduced the number entity.

It should be fairly easy to never show decimals. I just havenā€™t been bothered to do it yet.

If you wait more time it will change it back to integer. donā€™t know at this moment how to get rid of the point.

I would probably create a template sensor where I forced it to round it, and use that instead.

That and of course create a bug report for the Miio integration, so they can fix the original issue.

Guys sorry if itā€™s a stupid question, but i am a newbie

I have added my purifier using the Miio integration, copied every single line from the Dec 20 post, apart from the line where it states how to connect, but buttons do not work

Did i do anything wrong?

It still takes me a long time to update the sensors ā€¦ minutes

variable|float|round|int

Should be seconds. You are using the official integration?