Kogan Smart Air Purifier 2S working with ESPHome

I managed to get my Kogan Air purifier (~ $120 AUD) working with ESPHome (With a lot of help from @jesserockz & @ssieb over on the ESPHome Discord).

Here’s the ESPHome device basic config.

This is a small/cheap purifier. I have a larger Xiaomi one for my living areas and use this one in my bedroom mainly in sleep mode (quiet).

The brains are a TYWE1S (which has a ESP8266EX).

And the Particulate matter sensor it uses is a PM1006, which is also supported by ESPHome (more on that later). You’ll see only tx is connected here.

Flashing the TYWE1S via Tuya-convert did not work for me, so I moved on to trying serial flash. Try this thread for flashing tips (note one post about maybe needing the reset pin).

After having no luck flashing via the U1TX/U1RX pins, I thought I’d try via the U0 pins as suggested by others, but unfortunately accidentally stripped away the conductive material from the U0 and IO0 pins, and was feeling a bit stuck.

For me soldering was tricky and tight. But I reckon if you have better soldering skills than mine you might be ok with serial flashing. It’s likely you need to flash via these U0TX and U0RX Pins. Would be good if someone can confirm flashing method with this device.

So I ended up actually cutting the traces to the TYWE1S and soldering them to a D1mini. Nice glue job too eh?

Then @jesserockz , ssieb & @nickrout schooled me up on the ESPHome TUYA MCU.

And I got a basic config flashed on the D1mini and figured out a lot of the data points.

I also hardwired the PM1006 rx/tx directly to a spare uart on the d1mini (as the Tuya MCU doesn’t report pm2.5) while retaining the existing PM1006 connector, hoping that the PM1006 would send data to two devices. But connecting this seemed to disable the Tuya MCU reporting and you loose auto mode on the device.

You could replace the devices auto mode with some ESPHome on_value_range automations, however the LED colour (and the beeper) do not seem to have a controllable data point, so you’d loose the visual indicator of air quality. Maybe that can be improved/resolved?

Next Steps:

* Write up basic config for ESPHome device page (not far off) Done

  • Probably tweak my config a bit (maybe with a DIY auto mode)
  • More testing.

I’ll refine this OP as I go.

Draft working config is below for my D1mini. The config I do for the ESPHome page will be more basic and for the TYWE1S rather than my D1mini

  name: kogan-air-purifier

  name: "${name}"
  platform: ESP8266
  board: d1_mini
  ssid: "your_ssid"
  password: "your_password"
    static_ip: 192.168.1.xxx
    gateway: 192.168.1.z
  # #Set up a wifi access point
  # ap: {}

# Enable logging
  baud_rate: 0
# Enable Home Assistant API

# Allow OTA updates

#Serial connection between the TYWE1S and the Tuya MCU
  - id: uart_0
    rx_pin: GPIO3
    tx_pin: GPIO1
    baud_rate: 9600
#Optional: Example for if you hardwire the pm1006 
#Serial connection to the pm1006 (seems to disable the Tuys MCU's Ait Quality reporting and auto mode though) datapoint 22 
  - id: uart_1
    rx_pin: GPIO2
    tx_pin: GPIO13
    # tx_pin: 
    baud_rate: 9600

  - platform: pm1006
    uart_id: uart_1
    update_interval: 10s
    #You can hardwire the 1006 to your esp and recieve PM2.5 values which do not appear to be sent via any TUYA datapoints. 
    #However it seems to then prevent datapoint 22 transmitting and you appear loose the auto function.
      name: "Particulate Matter 2.5µm Concentration"

#Tuya component: https://esphome.io/components/tuya.html
  uart_id: uart_0

#Tuya Fan: https://esphome.io/components/fan/tuya.html
  - platform: tuya
    name: ${kogan-air-purifier} 
    switch_datapoint: 1 #ON, OFF
    speed_datapoint: 4 # 0 = off, 1 = sleep, 2 = high, 3 = auto
    speed_count: 3

#19 Timer Mode
  - platform: tuya
    name: "${name} Timer Mode"
    number_datapoint: 19 # 0 = off, 1 = 4hr, 2 = 8hr
    min_value: 0
    max_value: 2
    step: 1
#20 Timer Countdown
  - platform: tuya
    name: "${name} Timer Countdown Mins"
    number_datapoint: 20 #counts down from inital timer mode value of 4hr = 240min or 8hr = 480min
    min_value: 0
    max_value: 480
    step: 1
#101 LED Brightness
  - platform: tuya
    name: "${name} LED Brightness"
    number_datapoint: 101 #0 = off, 1 = mid, 2 = high
    min_value: 0
    max_value: 2
    step: 1
#22 Air Quality Level
  - platform: tuya
    name: "${name} Air Quality Level"
    #Only seems to report air quality when in auto mode. 0 = Good, 1 = Yellow/Poor ,2 = Red/Bad
    number_datapoint: 22 
    min_value: 0
    max_value: 2
    step: 1
#5 Unknown   
  # - platform: tuya
    # name: "${name} DP5 Unknown" #Unknown. Could Filter Left?
    # number_datapoint: 5
    # min_value: 0
    # max_value: 200
    # step: 1
#11 Unknown   
# switch:
  # - platform: tuya
    # name: "${name} DP11 Unknown" #Unknown Could maybe be reset button or wifi connection?. Have not tested.
    # entity_category: config
    # switch_datapoint: 11

Fantastic, this is exactly what I’ve been searching for. After finding the FCC docs and getting the alternative model names this has I was able to find this post. The one I found is sold under the name Afloia Kiloplus air purifier http://amzn.com/dp/B09P8KBW5V but looks 100% the same otherwise.

1 Like

It’s all rebadged Tuya;)