Lovelace: Xiaomi - Mi air purifier 3H card

I see what you mean. I don’t have the model 3. What fan does?

I mean, what is the difference between Favorite and Fan?

“Fun” - 3 predefined levels - speed 33.33, 66.66, 100%

And Favorite?

15 predefined levels - in native Mi Home app corresponds to 15 manually selected coverage areas

I see. Then it is easy.
Define in template.yaml another sensor, something like:

- name: pi2_fan_level_template
    state: >
      {% fan_level=states('number.pi2_favorite_level') %}
      {% if fan_level > 10 %}
        {{ 'high' }}
      {% elif fan_level > 5 %}
        {{ 'medium' }}
      {% else %}
        {{ 'low' }}
      {% endif %}

and in script.yaml the other way around.

You can use those 2 in Lovelace to have the status and the action

Could be a solution. Not entirely sure that 4 correspond to low, 9 to medium and 14 to high but worth checking. However in Miio 3H we have this predefined in speed list. and also in percentage step.

I reckon you don’t have the number.pi2_favorite_level defined in MIoT, but you can translate the percentage in levels with a template.

On the other hand, I’ve been thinking about what you said, that having in MIoT only the local IP and the token means it is local. I’m not entirely sure about that. Having the token means you already are enrolled on the cloud, then the device knows what the cloud address is and the cloud knows who you are based on the token.

But you did not provide any credentials. On the other hand you could reset the wifi, get the new token without enrolling it in the cloud. The product can be integrate into HA. Worth testing

If you reset the wifi and get a new token and then run xiomi_token_extractor.exe you probably see the new token extracted from the cloud. It worth a try. Btw the device passes through the firewall set based on the local IP.

You need the token also with official integration if you choose to configure manually. Also there you have cloud and manual.

You are right. I didn’t test if the device still communicate with the cloud even if we talk to it locally. On the other hand, the MIoT README_en.md is somehow unclear about this issue:

"The device that implements miio instead of MIoT cannot be accessed via LAN. But don’t worry. Xiaomi Cloud is able to convert MIoT commands to miio commands and send them to the device via Internet. With your Xiaomi account, the integration sends commands - instead of to devices - to Xiaomi Cloud, so that all devices can work properly.

You can specify each device whether use Cloud Access or not. Please not that these devives will not work without Internet. Take care when use them in some important automations. To help you tell out devices with Cloud Access, there will be cloud in their entity ids."

I understand this is for older devices working only with miio. New devices are compatibile to MIoT standard and can work locally.

Hello
After acting on buttons (auto, silent, etc), they are not chaining the color… any idea?

read our discussion above :grinning:

Hi schilea,

i updated to the latest HA version and used your config-files from 14.09.2021 and the mentioned Xiaomi MIoT HACS Integration - but my lovelace card doesn’t work.

Do you have any ideas?

Errorlog says:

Unable to find referenced entities fan.mi_air_purifier_3h

23:40:00 – (WARNUNG) helpers/service.py

Error initializing ‘AP01 - Air Purifier turn on’ trigger: In ‘numeric_state’ condition: unknown entity sensor.mi_air_purifier_3h_pm2_5

23:32:10 – (WARNUNG) Home Assistant Core Integration

You need to ensure that your purifier entities are actually called fan.mi_air_purifier_3h and sensor.mi_air_purifier_3h_pm2_5

Hello, I only update the status by refreshing the browser with F5. I am using the official version of xiaomi miio. Any solution? In the past it worked for me without problems, I don’t understand anything … thanks for your help.

Looks way better - but still two wrong buttons inside. Also any ideas for this? “Sadly” only one more error in the log - but it’s not related to this. I deleted that old addon but funnily he still tries to use it - for whatever reason.

image

Logger: homeassistant.components.fan
Source: helpers/entity_platform.py:164
Integration: Ventilator (documentation, issues)
First occurred: 21:19:40 (1 occurrences)
Last logged: 21:19:40

The xiaomi_miio platform for the fan integration does not support platform setup. Please remove it from your config.

Also the same for temperature and humidity that are now separate sensors and not attributes like before. Pay attention to the new names sensor.mi_air_purifier_3h_temperature and sensor.mi_air_purifier_3h_humidity. You have to replace them inside the card with the correct ones.