Skip to content

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor

License

Notifications You must be signed in to change notification settings

fantasytu/homebridge-mijia-thermometer

Repository files navigation

Homebridge Mijia Thermometer Plugin

npm github license donate donate-alipay

This is a Homebridge plugin to provide for Xiaomi Mijia Thermometer(specifically LYWSD03MMC).

If you like this plugin, don't hesitate to "Star".

Installation

sudo npm i -g homebridge-mijia-thermometer@latest

These libraries and their dependencies are required by the Noble library and provide access to the kernel Bluetooth subsystem:

Ubuntu/Debian/Raspbian

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev

Fedora/CentOS/Other-RPM based

sudo yum install bluez bluez-libs bluez-libs-devel
sudo yum install systemd-devel
sudo yum provides */libudev.h

For more detailed information and descriptions for other platforms please see the Noble documentation.

Configuration

Configuration on Homebridge Config UI X is supported.

Alternatively, you could update your Homebridge config.json file according to these parameters.

Key Default
accessory MijiaThermometer Required. The name of this plugin.
name Thermometer Required. The name of this accessory. This will appear in your Home app.
address a0:c1:0c:d4:e1:6b Required. The address of the device.
bindKey bhrthjb9mg4980hu80xvosbgzf1toh8p Required. The key to decyrpt BLE data.
humidityName "Humidity" Optional. Name of the humidity sensor as it will appear in your Home app.
temperatureName "Temperature" Name of the temperature sensor as it will appear in your Home app.
lowBattery 10 At what battery percentage Homekit should start warning about low battery.
temperatureOffset 0 An offset to calibrate temperature values if measured incorrectly.
humidityOffset 0 An offset to calibrate humidity values if measured incorrectly.

Getting BindKey

post.

Automatically Retrieved Model, Serial Number and Firmware Revision

Version 1.6 supports to retrieve model, serial number and firmware revision via BLE advertisement.

Since information service is initialized before the Bluetooth scanner, so the information retrieved is cached into a file (stored at '~/.homebridge/.MijiaThermometer/') that will be loaded at the SECOND boot. So in order to make sure this function works well, it is highly suggested to reboot Homebridge after your device is connected and four of these following messages have been displayed in console.

Device Info cached!

Tested On

  • iOS 15
  • Apple Home
  • Homebridge 1.3.4 ( running on Centos 8 with Bluetooth Chip RTL8761B )

Other issues

Running without root/sudo (Linux-specific)

Run the following command:

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

This grants the node binary cap_net_raw privileges, so it can start/stop BLE advertising.

Using Bluetooth 5.0 USB Dongle with RTL8761B chipset on Linux kernel 5.10

Tutorial is listed in this git.

Troubleshooting

If you have any issue, contact me(f.tu@me.com) or just submit an issues.

About

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published