Crates.io | mijia-homie |
lib.rs | mijia-homie |
version | 0.2.7 |
source | src |
created_at | 2020-10-31 18:41:10.355648 |
updated_at | 2023-09-02 12:49:21.813787 |
description | Service to connect to Xiaomi Mijia 2 temperature/humidity sensors over Bluetooth and report their readings to an MQTT broker following the Homie convention. |
homepage | |
repository | https://github.com/alsuren/mijia-homie/ |
max_upload_size | |
id | 307293 |
size | 100,402 |
mijia-homie
is a service for connecting to Xiaomi Mijia 2 Bluetooth temperature/humidity sensors
and publishing their readings to an MQTT broker following the
Homie convention.
See the main project readme for more details and background.
It is recommended to install the latest release from our Debian repository:
$ curl -L https://homiers.jfrog.io/artifactory/api/security/keypair/public/repositories/homie-rs | sudo apt-key add -
$ echo "deb https://homiers.jfrog.io/artifactory/homie-rs stable main" | sudo tee /etc/apt/sources.list.d/homie-rs.list
$ sudo apt update && sudo apt install mijia-homie
Alternatively, you may install with cargo install, but that will require some more setup:
$ cargo install mijia-homie
If you have installed the Debian package, the service will be set up with systemd for you already.
Otherwise, copy the mijia-homie
binary to /usr/bin
, copy debian-scripts/mijia-homie.service
to
/lib/systemd/system
, create a mijia-homie
user to run as, and create /etc/mijia-homie
for
configuration files.
There should be two config files under /etc/mijia-homie
:
mijia-homie.toml
contains the main configuration for the service, such as which MQTT broker to
connect to and the name and ID of the Homie device. See
mijia-homie.example.toml for an example of the settings that are
supported.
sensor-names.toml
contains a map of sensor MAC addresses to human-readable names. Only the
sensors listed in this file will be connected to, so you will need to fill it in before
mijia-homie
does anything useful. Each line should be of the form:
"A4:C1:38:D7:21:17"="Landing"
After editing these config files you will need to restart the service:
$ sudo systemctl restart mijia-homie.service
You may find it helpful to watch the logs to see whether it is managing to connect to your sensors:
$ sudo journalctl -u mijia-homie.service --output=cat --follow
Once it is running, try connecting to your MQTT broker with a Homie controller such as HoDD or openHAB to see your sensors.
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.