Integrating a Xiaomi Mijia LCD Bluetooth temperature sensor a Home Assistant

3 minutes of reading
  • Software use and configuration
GUIDE more indicated for:

All environments

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.
Driving review: 1.1


Xiaomi Mijia LCD Bluetooth Thermometer / Hygrometer - Front

Il stemperature / humidity sensor Xiaomi Mijia LCD Bluetooth it is a small domotic component particularly apprezzato for design, price and functionality.

It is a small circular wall-mountable element with an LCD display, which allows easy reading of environmental parameters such as temperature and humidity. Its most interesting feature is that it has an antenna Bluetooth LE, which allows him to connect to the most common smartphones / tablets and then to theapp of managing his family products, the Xiaomi Smart Home.

This connection capacity can also be used to integrate this component to the most common HUB personal, among which Home Assistant. For this purpose, Home Assistant provides an ad hoc platform call "Xiaomi BLE Temperature and Humidity sensor"

In this guide we see how to implement this integration in order to equip ourselves with temperature and relative humidity sensors starting from the readings of this small sensor.

Nb Unfortunately, this integration uses the library btlewrap, which is not available on Windows/Mac, therefore the requests Home Assistant based on these systems they cannot benefit from this integration. But it exists - perhaps - an alternative.

ALTERNATIVE. any proproblems with the integration platform available on Home Assistant they can - sometimes - be mitigated or overcome through the adoption of this other custom component, not the subject of this guide.

Address MAC

To integrate the sensor it is necessary to discover theaddress MAC Bluetooth.
To this end, a software tool will be used to perform one scan of the environment in search of MAC address of the head that interests us.


In case you use Raspbian on Raspberry and / or Linux you can use the tool hcitool.

If you do not have it, install it using the following commands:

sudo apt-get install bluetooth bluez bluez-tools rfkill rfcomm
sudo apt install expect
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service

That done, the command to scan is the following:

sudo hcitool lescan

which should return an output of this type:

LE Scan ...
38:01:95:84:A8:B1 (unknown)
00:1A:22:0A:91:CF (unknown)
00:1A:22:0A:91:CF MJ_HT_V1

Usually MAC address of these sensors begin with "00: 1A: 22 ...", And in any case are recognized by the tool with the label"MJ_HT_V1

An alternative is the use of the command


Which should return an output of this type:

[bluetooth]# scan on
Discovery started
[CHG] Controller XX:XX:XX:XX:XX:XX Discovering: yes
[NEW] Device 4C:65:A8:D2:31:7F MJ_HT_V1


At this point it is possible to configure the integration between the sensor and Home Assistant.
the configuration basis of the platform at the file configuration.yaml it's pretty simple.

It will be sufficient to insert an entry of this type:

# Esempio di configurazione
  - platform: mitemp_bt
    mac: 'xx:xx:xx:xx:xx:xx'
    name: Stanza da letto
    force_update: false
    median: 3
      - temperature
      - humidity
      - battery

Prosee now at reboot di Home Assistant.

In the case of the example above, the configuration will generate three type entities "Sensor"So called:

  • sensor.mitemp_bt_battery (Friendly name "MiTemp BT Battery")
  • sensor.mitemp_bt_humidity (Friendly name "MiTemp BT Humidity")
  • sensor.mitemp_bt_temperture (Friendly name "MiTemp BT Temperature")

The first is the rappresentation of battery level of the sensor, the second the level of relative humidity and the third that of temperature.

Obviously in the case of multiple sensors it will be sufficient to indicate more MAC address:

# Esempio di configurazione
  - platform: mitemp_bt
    mac: 'xx:xx:xx:xx:xx:xx'
    name: Stanza da letto
    force_update: false
    median: 3
      - temperature
      - humidity
      - battery
  - platform: mitemp_bt
    mac: 'yy:yy:yy:yy:yy:yy'
    name: Stanza da pranzo
    force_update: false
    median: 3
      - temperature
      - humidity
      - battery

Nb the correct functionnameof the platform is subject to the radio coverage of the actuator by the Bluetooth antenna of the computer on which it is running Home Assistant.

Rappresentation and services

The type entity "Sensor"Will come rappresented as any other sensor (temperature, or relative humidity) integrated a Home Assistant:

Home Assistant - temperature sensor

which (or which) can be used - as well as an element to be consulted - like trigger and / or condition in ours automations or in other typical scenarios of Home Assistant

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel