Blitzhome BH-AP2501 Air Purifier

I’ve been able to integrate the BlitzHome BH-AP2501 Air Purifier via the TUYA plugin.
This device is pretty nice, since the PM2.5 sensor allows you to create your own custom air quality based filtering setting. This allows you to find your own balance between noise and clean air.

First, I made sure to filter the PM2.5 sensor data, because it is noisy and introduces random spikes:

# Smooth the air purifier pm25 data
sensor:
  - platform: filter
    name: "Living Room Climate PM25"
    entity_id: sensor.blitzhome_air_purifier_particulate_matter_pm25
    filters:
    - filter: outlier
      window_size: 4
      radius: 4.0
    - filter: lowpass
      time_constant: 10
    - filter: time_simple_moving_average
      window_size: "00:02"
      precision: 1

Then I created an automation to set the fan speed based on the filtered data:

alias: Air purifier
description: ""
trigger:
  - platform: numeric_state
    id: pm2_high
    entity_id: sensor.living_room_climate_pm25
    for:
      hours: 0
      minutes: 0
      seconds: 30
    above: 50
  - platform: numeric_state
    id: pm2_medium
    entity_id: sensor.living_room_climate_pm25
    for:
      hours: 0
      minutes: 0
      seconds: 30
    above: 20
    below: 50
  - platform: numeric_state
    id: pm2_low
    entity_id: sensor.living_room_climate_pm25
    for:
      hours: 0
      minutes: 0
      seconds: 30
    below: 10
condition: []
action:
  - type: turn_on
    device_id: 3d351ca64833c4669ab74e68e2d217ab
    entity_id: fan.blitzhome_air_purifier
    domain: fan
  - choose:
      - conditions:
          - condition: trigger
            id: pm2_high
        sequence:
          - service: fan.set_preset_mode
            data:
              preset_mode: H
            target:
              entity_id: fan.blitzhome_air_purifier
          - type: turn_on
            device_id: 3d351ca64833c4669ab74e68e2d217ab
            entity_id: switch.blitzhome_air_purifier_ionizer
            domain: switch
      - conditions:
          - condition: trigger
            id: pm2_medium
        sequence:
          - service: fan.set_preset_mode
            data:
              preset_mode: M
            target:
              entity_id: fan.blitzhome_air_purifier
      - conditions:
          - condition: trigger
            id: pm2_low
        sequence:
          - service: fan.set_preset_mode
            data:
              preset_mode: Sleep
            target:
              entity_id: fan.blitzhome_air_purifier
          - type: turn_off
            device_id: 3d351ca64833c4669ab74e68e2d217ab
            entity_id: switch.blitzhome_air_purifier_ionizer
            domain: switch
    alias: Choose preset
mode: single

I can highly recommend this device based on my experience of the last two months. It cleans fast when it needs to and being able to tweak the fan speed based on the PM2.5 sensor works brilliantly!

BTW: I bought mine via Bangood for around a 100 bucks.

I just converted it to ESPHome, since I dislike the Tuya integration. GitHub - wildekek/BlitzHome-BH-AP2501