Ok, understand now.
This is not how it design to work at the moment. It just modified favorite level, you can check when expanding the purifer properties, but does not change the mode. You can see in the picture favorite level changing from 0 to 6 but not the mode. Probably it is a good idea to change also the mode. Let me think about it.
So now you first have to select the mode on Favorite then to change the level or coverage as you wish.
To be more precise it should work like in Mi Home app: when selecting Favorite/Manual Coverage to be visible, otherwise hidden, also for Fan to have the 3 levels available only when this mode is selected, otherwise hidden.
Unfortunately at this moment donât know how to hide fields in HA based on other fields status.
But it is a good idea also to change the mode when changing fan, favorite or coverage. So let me think about it.
Iâve adjusted the auto mode automation to run every 5 minutes rather than every hour
- id: '1585984405489'
alias: Air Purifier set favorite level based on PM2.5
description: ''
trigger:
- minutes: "/5" # run when minute of the hour is dividable by 5
platform: time_pattern
condition:
- condition: state
entity_id: fan.mi_air_purifier_3h
state: 'on'
action:
- data_template:
speed: Favorite
entity_id: fan.mi_air_purifier_3h
service: fan.set_speed
- data_template:
level: '{% if states("sensor.mi_air_purifier_air_quality_pm25") | int > 50 -%}
14 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 40 -%}
12 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 30
-%} 9 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 20
-%} 6 {%- else -%} 4 {%- endif %}
'
entity_id: fan.mi_air_purifier_3h
service: xiaomi_miio.fan_set_favorite_level
Iâm not sure if the data template for the set level is working correctly as at night it was increasing the favourite level quite a bit and then 5 minutes later dropping itâŚ
As for the pm 2.5 history it looks below 5 all night which seems odd
I am just looking at this after getting a Air Purifier 3 and there is one function that doesnât work properly here.
The Air Purifier 3/3H models have an OLED Display. That means they do not use the xiaomi_miio.fan_set_led_off or xiaomi_miio.fan_set_led_on commands as the LED display has Off, Dim and Bright as three options.
It might need that toggle to be replaced with a slider that can do 0, 1, 2 for command xiaomi_miio.fan_set_led_brightness
Hi Brendan. Just check and you are right, but instead of xiaomi_miio.fan_set_led_off or xiaomi_miio.fan_set_led_on that are not working, you can use xiaomi_miio.remote_set_led_off or xiaomi_miio.remote_set_led_on. It will just switch off, switch on the screen and Iâve changed this into configuration files above.
What you propose is a little bit more complicated and requires (like for defining slider for fan level) an input number entity, plus 2 automation, one to update the purifier brightness value to input number value and the second one to update the slider value on purifier brightness. It is not rocket science, just copy and modify the existing automation, but donât know if worth the effort as I, for example, set the brightness to 1 and leave it like that.
I noticed also the Air Purifier does not sync to home assistant if the settings are changed in the Xiaomi App or on the front of the purifier. Is this correct or did I do something wrong?
It should as there are some automations just for this. But sometimes it take some time for HA to get the feedback from the purifier. You could always check the values received by HA by just checking the purifier.
I had a play with the automations in this thread. It pretty well behaves identically to having the Air Purifier 3H in Auto mode, so they are kind of superfluous. I do appreciate the lovelace card setup however and find that quite useful. The only thing I found is I had to get rid of the âFanâ mode and use just Favorite, Auto and Silent as when the Air Purifier is set to Auto mode (not using HA automations for quailty control) the Auto speed would ramp up and the Fan mode would cut in and set the Purifier to a fixed level. Once I deleted the relevant Fan mode automations, this ceased to happen. Might be a thing with the latest firmware, not sure, but that was my experience.
I read the article on Air Purifiers in Auto mode. That article is not really current but basically it says donât trust the auto sensors in the Air Purifiers. That means not trusting the readings of the sensors on the device.
The Xiaomi Air Purifier 3 actually has a reasonable sensor (in my one at least) and itâs auto mode is quite adequate for general use. One caveat here. Having the Air Purifier in âOFFâ makes itâs internal sensor highly inaccurate as it needs the fan to be moving air over the sensor in order for it to work correctly.
The only way the automations in this thread will work correctly is by using an external air quality sensor and not using the one built in to the machine, as it introduces the same inaccuracies as using auto mode on the machine itself.
I appreciate the effort put into them, but for people looking at automations here, use an external Air Quality sensor, otherwise it really wont be different to using Auto Mode on the Xiaomi device.
The automations are still useful when used with an external sensor. Donât rely on the internal sensor on the Xiaomi device to be accurate on every device.
Hi @brendan, appreciate your feedback. What I have thought and created this card my intention was to replicate functionalities from Mi Home app. I have also noticed issues with Fan, when sometime you set a different mode, like Favorite, but it switch to Fan. Please be careful when removing Fun, if you also use the Xioami app, there will be no mode displayed on the card. Basically, 2 of the automation, continuously check the operation mode with the purifier and update the card and vice versa when you change something on the card updates the purifier.
Also, regarding the auto mode, I totally agree with you for an external sensor, but the overcame if you donât have one is the automation that first starts the purifier if a certain level is detected in auto, then, after a while, it change it according to your predefined Favourite levels depending on accurate PM2.5 reading in Auto mode ON.
Regarding the sensor accuracy, I have also bought a Smart Mi PM2.5 sensor, and it indicates the same value as Xiaomi sensor when ON. Havenât tested on OFF.
Mine is pretty accurate when it is on also, but when it is off, the little fan on the sensor is not running, so it doesnât detect the particles in the air well. Not sure if this is a firmware update thing or whether they all do it. I am running latest firmware.
You are right about needing to be careful removing the fan automations. In my case, I donât use the Mi Home app or the button on the front of the device, so it works out for me.
Anyone that uses the Mi Home app or the button on front of the device for control will need to keep the Fan automations as you posted them and just put up with the setting changing during auto operation.
With latest version of Home Assistant we need to change the remote_set_led command back to fan_set_led
First of all, thank you for your effort. Followed the instructions and got everything to work more or less.
Iâm using Air Purifier 3H and the xiaomi_miio.remote_set_let_on/off did not work, it complained about a missing command. I used xiaomi_miio.set_led_brightness instead, 0 for on and 2 for off.
Also, LED brightness information seems to be missing on mine, showing 0 all the time.
@brendan the firmware has nothing to do with the accuracy. Just there are no air currents so the estimation is based just on the air around the purifier.
@bjorn.sivertsen the pm2.5 automation is only changing the favorite level, not the fan level.
I am having on my purifier a much more aggressive strategy:
Donât know why it doesnât start in your case. Maybe the air quality is good. Try to fry something in the kitchen and it should automatically start. Tested myself.