Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Python and python framework

Moderator: leecollings

Post Reply
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by febalci »

xiaomi_pm2.5.jpg
xiaomi_pm2.5.jpg (14.01 KiB) Viewed 5240 times
This plugin connects Domoticz directly to your Xiaomi PM2.5 Sensor and gets aqi index and battery status every 30 seconds. You have to place plugin.py, xiaomiaqi.py files and pyaes directory together with its files into a /xiaomi folder under plugins.

Please inform me of any bugs or problems.

Plugin Download: https://github.com/febalci/DomoticzXiaomiPM2.5
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by Derik »

mmm Thanks for this great work!!
I see this sensor and was thinking to buy it..
Only can you please tell me what the devices are in Domoticz? [ or a screendump ]

Looks a nice peace of hardware.. only what can i do with it??
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by febalci »

Well it's fit for purpose device. First of all it doesn't have humidity or temperature, only PM2.5 particles in the air which denotes air pollution. Like smoking, gas, CO, dust etc. When i smoke in the same area it goes directly to red zone! Very good for childrens room if the room needs any clean air. It also has a rechargeable battery which goes around 2-3 hrs. The plugin reflects the AQI value (also commenting as excellent, good, bad, hazardous etc) and battery level. I can send a screenshot tomorrow.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by febalci »

Hi again,
This is the device:
Screen Shot 2018-01-30 at 18.36.14.png
Screen Shot 2018-01-30 at 18.36.14.png (25.28 KiB) Viewed 5191 times

And this is the devices page:
Screen Shot 2018-01-30 at 18.36.14.png
Screen Shot 2018-01-30 at 18.36.14.png (25.28 KiB) Viewed 5191 times
Now that i realized, i have to use a custom device for this, because this is ppm, whereas PM2.5 is micrometers/something. And so comments doesn't fit like excellent, good bad etc.
Attachments
Screen Shot 2018-01-30 at 18.40.43.png
Screen Shot 2018-01-30 at 18.40.43.png (41 KiB) Viewed 5191 times
bluedmx
Posts: 2
Joined: Thursday 31 May 2018 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9564
Location: France
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by bluedmx »

Hi,
i have installed 2 py files and directory under plugins xiaomi folder. I have created a material and after Domoticz was crashing. Need to delete the plugin resources to be able to launch again Domoticz.
Server : Raspberry PI 3B+ Raspbian Stretch.
Domoticz release : v3.9469
Best Regards.
bluedmx
Posts: 2
Joined: Thursday 31 May 2018 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9564
Location: France
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by bluedmx »

Hi, i have removed python 3.5 and libpython3.5 and now Xiaomi PM 2.5 is working and no longer crash when installing plugin.
sudo apt-get remove python3.5
sudo apt-get remove python3.5-minimal
sudo apt-get remove libpython3.5
sudo apt-get remove libpython3.5-minimal
Best Regard.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by deennoo »

With the lastest FW update the device now need to have a token to retrieve information.

I'll try to update the plugin from github
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
greenwitch
Posts: 24
Joined: Saturday 26 May 2018 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by greenwitch »

Hi,

I am on firmware version 1.4.3_8103
How do you get the token?
I am not able to get one from nodejs miio solution I used before.
I can retrieve only one for air purifier but not for air monitor.
I do not see also any instruction in any github project
https://github.com/deennoo/domoticz-AirMonitor
Can somebody help me.

Adam
greenwitch
Posts: 24
Joined: Saturday 26 May 2018 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by greenwitch »

Ok,

There is an answer:
https://python-miio.readthedocs.io/en/l ... -home-logs
With app 5.4.49 it is extremely easy!

Adam
qaigor
Posts: 2
Joined: Friday 15 December 2017 11:49
Target OS: Linux
Domoticz version:
Location: UA Kyiv
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by qaigor »

Hello is there any change to make it working with a new Xiaomi MiJia Air Quality Detector (KQJCY02QP)?

Image

It supports such dimensions:
PM2.5
TVOC
CO2a
Temp
Humidity
Ubuntu Server 18.04 LTS: Domoticz + MQTT / Xiaomi (ZigBee devices, Robot cleaner, YeeLight) , Broadlink RM pro IR+RF, RFLink (433MHz & 315MHz), ESPEasy (Sonoff, NodeMCU)
qaigor
Posts: 2
Joined: Friday 15 December 2017 11:49
Target OS: Linux
Domoticz version:
Location: UA Kyiv
Contact:

Re: Python Plugin: Xiaomi PM2.5 Air Quality Sensor

Post by qaigor »

Finally I found a solution with HA:
https://telegra.ph/Dobavlenie-Xiaomi-Mi ... tant-08-26

Unfortunately the manual is in Russian
Ubuntu Server 18.04 LTS: Domoticz + MQTT / Xiaomi (ZigBee devices, Robot cleaner, YeeLight) , Broadlink RM pro IR+RF, RFLink (433MHz & 315MHz), ESPEasy (Sonoff, NodeMCU)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest