This is a project for capturing BLE data from a Xiaomi Mijia 2 hygrometer-thermometer and publishing it. The repository includes a number of related crates:
If you want a bit more back-story, there is also a slide deck.
To run this code on your Raspberry Pi, you will need:
After following these steps, you should end up with something that looks like this:
Start by finding out which sensors you have:
TARGET_SSHfirstname.lastname@example.org EXAMPLE=list-sensors ./run.sh
Add each of the sensors to
/home/pi/sensor-names.toml on the Raspberry Pi. Each line should be
of the form:
If you don’t know the sensor names yet, just make some names up for now.
You will also want to copy
/home/pi/mijia-homie.example.toml and edit it to suit your needs.
You should then be able to run the publisher using
run.sh with default arguments:
This will start the publisher under systemd and show you the logs.
It takes a while to connect to all of the sensors and start getting readings. Once everything is running, you can use HoDD to see your readings.
If everything is visible in HoDD then you can add other integrations. Anything that understands Homie should be able to read your sensors. OpenHAB is what we’re using, but take a look at the Homie Implementations page and see if anything inspires you.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.