Working with Xiaomi Mijia BLE Temperature Sensor in Home Assistant
The 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 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 determine its MAC address and make changes to the HA configuration file.
Determine 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 detected devices will be displayed in the terminal window. The sensor sends data approximately every 30 seconds and information from the sensor should appear after a while. We are interested in the device with the identifier 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:
This list must also contain the desired device:
Exit the utility:
Adding a sensor to Home Assistant
Home Assistant has native support for Xiaomi Mijia BLE MJ_HT_V1 sensors via mitemp_bt integration. Add the following lines 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
- mac - the MAC address of the sensor;
- name - the name of the sensor displayed in the Home Assistant;
- force_update - force the data from the sensor to be updated in HA even if it does not change ;
- median - allows you to exclude errors from the sensor (sudden changes in temperature and humidity values). In this example, averaged data for 3 samples is transmitted;
- monitored_conditions - parameters to be monitored are specified. In this example, these are: temperature, humidity, and battery charge.
After making changes to the configuration file, you must restart the Home Assistant server.