Skip to content

dhewg/esphome-miot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESPHome components for MIoT devices

These ESPHome components are designed for MIoT devices which adhere to the Xiaomi MIoT Serial Communication protocol.

Such devices contain two microcontrollers, one actually controls the hardware (MCU), and the other acts as a LAN/cloud gateway.

These components allow you to replace the firmware on the latter, hence liberating your devices from the vendor cloud.

Since this uses ESPHome, adding your liberated devices to Home Assistant becomes a breeze with the official integration:

controls sensors config diag

Supported devices

There are probably many more devices that could be supported, currently there are ESPHome configs for the following:

Device Model Version Wiki ESPHome Config MIoT Specification
Mi Air Purifier 3H zhimi.airpurifier.mb3 link zhimi.airpurifier.mb3 link
Mi Air Purifier 3C zhimi.airp.mb4a
zhimi.airpurifier.mb4
link zhimi.airp.mb4a link
link
Xiaomi Smart Air Purifier 4 zhimi.airp.mb5 link zhimi.airp.mb5 link
Xiaomi Smart Air Purifier 4 Lite zhimi.airp.rmb1 link zhimi.airp.rmb1 link
Xiaomi Smart Air Purifier 4 Pro zhimi.airp.vb4 zhimi.airp.vb4 link
Xiaomi Mi Smart Standing Fan 2 dmaker.fan.p18 dmaker.fan.p18 link
Xiaomi Smart Pet Food Feeder mmgg.feeder.fi1 link mmgg.feeder.fi1 link
Smartmi Evaporative Humidifier 2 zhimi.humidifier.ca4 zhimi.humidifier.ca4 link
Smartmi Air Purifier zhimi.airpurifier.za1 zhimi.airpurifier.za1 link

Some of the devices have more than one model (like Mi Air Purifier 3C). If their MIoT specifications are compatible, the ESPHome config will be usable with all of them.

Unsupported devices

  • Devices without a dedicated MCU, using only the ESP chip to directly control the hardware.

    As these components are designed around the communication protocol between the two microcontrollers they're of no use for such devices.

  • Devices using a proprietary Xiaomi WiFi microcontroller.

    That hardware is currently unsupported by PlatformIO and hence ESPHome.

  • Devices that use the legacy miio protocol.

    Such devices may have an ESP chip and a separate microcontroller, but the communication protocol is unsupported by these components.

    If the device has the miio2miot tag on the Xiaomi MIoT Spec site, or if you see messages like props power "on" on the serial bus, this is the case.

Known unsupported devices:

Reason Device Model Version Wiki MIoT Specification
Proprietary chip Mi Air Purifier 2S zhimi.airpurifier.mc1 link link

Building a firmware

Either download an ESPHome config or create your own (see below) and feed it to ESPHome to build the firmware.

There's no need to clone this repo, unless you plan to contribute - which would be very welcome!

Adding devices

First, look up the desired device on the Xiaomi MIoT Spec site.

Each device defines its service (SIID) and property (PIID) IDs. You just have to add all the desired properties with their according IDs to your ESPHome yaml config.

Alternatively, you can use the online miot2esphome utility to try to automatically generate a starter configuration for you, based on the published device specs. You can then edit this to make sure everything works.

For examples, see the supported devices table above and compare a config against its specification.

Once your newly added device is working, please open a PR to add its config here!

Feedback

Please feel free to open issues and/or pull requests here.

Alternatively, there's a thread on the official ESPHome forums.

Inspired by

https://github.com/jaromeyer/mipurifier-esphome