Xiaomi Mijia Sensor

A cheap £3 purchase from Ali Express. I’d forgotten about buying this as it took a few months to come!

This sensor measure temperature and humidity, and gives a small smiley face depending on the status of the measurements. The sensor can be accessed via an app, which shows an accumulated history of readings.

One thing I did get this sensor for was to experiment and see if I could get the sensor readings out myself. The sensor values can be accessed via low-powered Bluetooth (BLE).

I found a python script on GitHub which did just that. Installed on a Pi Zero and set at 30 minute intervals via a cron job, I can read the temperature, humidity, battery voltage and battery level from the Xiaomi and write to a file (format below).

sensorname,temperature,humidity,voltage,batteryLevel,timestamp xiaomi 19.0 70 2.891 79 1599210044

Good little sensor! I wonder if the battery life is quite limited, as it’ already down at 79% after 5 days, so maybe I’ll change the cron job to every hour.

LYWSD03MMC Xiaomi Mijia Python Script:

https://github.com/JsBergbau/MiTemperature2