Integrating a Xiaomi Mijia temperature sensor Bluetooth LCD to Homebridge

3 minutes of reading
  • Software installation and configuration


Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.


Xiaomi Mijia LCD Bluetooth Thermometer / Hygrometer - Dimensions

The plugin "homebridge-I-hygrothermograph”Is a plugin designed to take advantage of the computer's Bluetooth LE capabilities on which Home is runningbridge in order to communicate with the sensor temperature / relative humidity of the Xiaomi LCD Bluetooth, sensor particularly apprezzed for price, design, functionality, precision and degree of home automation integration with the major ones HUB personal.

We tested with success the functionnameof this plugin (of which we illustrate the methods of integration in this guide) on hardware Raspberry Pi; also there is no particular obstacle in the implementation of the plugin even on traditional computers with Windows, macOS, Linux: the important thing is that there is a Bluetooth LE antenna compatible with the open-source library "Noble".


Installation, like all plugins for Homebridge - it's very simple.

Run the following command - on unix-based systems (linux, Raspberry etc.) from the terminal, from systems Windows su procommand mpt:

sudo npm install -g --unsafe-perm homebridge-mi-hygrothermograph

and wait for the end of proprocedure. In the case of systems Windows, remove the prefix "sudo".

Nb. In case Homebridge is already running as a service (as described in our installation guides), prosee to interrupt it before installing using the command:

sudo systemctl stop homebridge

After installing the plugin it is necessary to install, in case they are not already present, the accessory libraries necessary for its functionnamento.
Therefore run the following command:

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

In the case of systems Windows, remove the prefix "sudo".


The plugin configuration includes the addition to the Home configuration filebridge of one or more accessories configured as follows:

"accessories": [
      "accessory": "Hygrotermograph",
      "name": "Temperatura e umidità"

Explanation of the fields.

accessory Required - Must necessarily be "Hygrotermograph".
name Required - Name of the accessory.
 Optional - Indica the address MAC of the sensor. To be used when multiple sensors are present.
timeout15Optional - Number of minutes after which a sensor that does not respond is considered by the home automation as "not available". Set 0 to disable the feature (or omit the entry).
“Humidity”Optional - Moisture sensor name at theapp "Home".
temperatureName“Temperature”Optional - Temperature sensor name at theapp "Home".
fakeGatoEnabledfalseOptional - Whether or not to report historical information for use by theapp Elvate Eve.
MQTT Optional - Topic mqtt with which to publish historical readings (interesting for a possible use, for example, with Node-RED). Explained later in the guide.
trueOptional - Force device discovery after loss of Bluetooth connection.
2500Optional - Wait time in milliseconds for automatic discovery after a possible loss of Bluetooth connection.

The configuration of the example allows Homebridge to find and automatically connect to the sensor, without need to indicate punctually the address MAC device.

In case they are present more sensors instead it is necessary to use a configuration similar to the following:

"accessories": [
      "accessory": "Hygrotermograph",
      "name": "Stanza 1",
      "address": "4c:64:a8:d0:ae:65"
      "accessory": "Hygrotermograph",
      "name": "Stanza 2",
      "address": "2c:34:b3:d4:a1:61"

which, appanointed, list punctually the addresses MAC of the various devices.


Obviously to indicate the addresses MAC in configuration it is necessary to know them.
In case you are using Raspberry PI (with Raspbian operating system), it is simply necessary to execute the following command:

sudo hcitool lescan

This command displays all the addresses on the screen MAC detected in the environment. The addresses MAC of the Bluetooth thermometer of our interest are those labeled as "MJ_HT_V1"

Users Apple macOS instead they can use tools like Bluetooth Explorer.
Users Appthe iOS can finally use theapp (for iPhone / iPad) nRF Connect.

Nb The addresses MAC detected in these last two cases (macOS and iOS) is reported with a format like "5C61F8CE-9F0B-4371-B996-5C9AE0E0D14B".


As previously suggested, this plugin also has interesting functionality to display the readings received from the sensor to topic MQTT published by any broker indicated in the configuration.

To activate this feature, simply add the following block to the accessory configuration (s):

  "mqtt": {
    "url": "",
    "temperatureTopic": "sensors/temperatura",   
    "humidityTopic": "sensors/umidita",
    "batteryTopic": "sensors/batteria",
    "username": "",
    "password": ""

Where in the field "url"The IP and port of our broker is indicated, in the fields"temperatureTopic","humidityTopic and "batteryTopic”Respectively the topics to be published containing information relating to temperature, humidity and status of the sensor battery.

Finally, the optional fields "username" and "password"Allow you to indicate any credentials to access the broker.


The accessories appaiono on HomeKit as two different temperature and humidity sensors. They can be used with the automations typical of the home automation environment Apple, especially through theapp Elvate Eve.

temperature and humidity at app "Home"

Update Searchnamento

To update the package is sufficient execute the following command:

sudo npm update -g -dev homebridge-mi-hygrothermograph

having previously taken care of having stopped any Home executionsbridge in progress.

Logo Appthe HomeKitsATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Appthe Homekits, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel