en:ha_mitemp_bt_howto  

Working with Xiaomi Mijia BLE Temperature Sensor in Home Assistant

JetHome H1 and Jethome D1 controllers have a built-in WiFi/Bluetooth module and allow you to work with Bluetooth devices. Below is an example of connecting Xiaomi Mijia BLE MJ_HT_V1 Bluetooth temperature and humidity sensor (round-shaped with display) to a controller with Home Assistant Core installed (installation in python virtual environment).

Instructions for connecting the sensor on the HA website: https://www.home-assistant.io/integrations/mitemp_bt/

To connect a sensor, you need to find its MAC address and edit the HA configuration file.

Determining the MAC address of the sensor.

Turn on the sensor and place it near the controller or at a short distance with a clear line of sight. Run the bluetoothctl utility and turn on the Bluetooth device scanning mode:

bluetoothctl
[bluetooth]#scan on

Information about discovered devices will be displayed in the console. The sensor sends data approximately every 30 seconds and information from the sensor should appear after a while. We are looking for the device with the identifier MJ_HT_V1:

...
[NEW] Device 4C:65:A8:D4:5E:BF MJ_HT_V1
...

This is the desired sensor and its MAC address - 4C: 65: A8: D4: 5E: BF

Stop the scanning process:

[bluetooth]# scan off

Display a list of found devices:

[bluetooth]# devices

This list must also contain the desired device:

...
Device 4C:65:A8:D4:5E:BF MJ_HT_V1
...

Exit the utility:

[bluetooth]# exit

Adding a sensor to Home Assistant

Home Assistant has native support for Xiaomi Mijia BLE MJ_HT_V1 sensors via mitemp_bt integration. The following lines must be added to the .homeassistant/configuration.yaml configuration file:

sensor:
  - platform: mitemp_bt
    mac: "4C:65:A8:D4:5E:BF"
    name: living_room_wall_temp
    force_update: true
    median: 3
    monitored_conditions:
      - temperature
      - humidity
      - battery

where:

  • mac - MAC address of the sensor;
  • name - the name of the sensor displayed in the Home Assistant;
  • force_update - force update data from the sensor in HA even if they do not change;
  • median - allows you to exclude errors from the sensor (sudden changes in temperature and humidity values). In this example, the averaged data for 3 samples is transmitted;
  • monitored_conditions - specifies the parameters to be monitored. In this example, these are: temperature, humidity and battery charge.

After making changes to the configuration file, you must restart the Home Assistant Core.

en/ha_mitemp_bt_howto.txt · Last modified: 2022/02/02 21:00 by Leonid Titov