This library lets you read sensor data from a Xiaomi Mi BluetoothLE Temperature and Humidity sensor.
NOTE: this library is not maintained - I am not using the device any more.
It supports reading the different measurements from the sensor
To use this library you will need a Bluetooth Low Energy dongle attached to your computer. You will also need a Xiaomi Mi Temperature and Humidity sensor.
To use with home-assistant.io, implement the following GIST in HA: https://gist.github.com/ratcashdev/28253bb2c220788e4961f213fe87ff33
This sensor relies on the btlewrap library to provide a unified interface for various underlying btle implementations
To use the bluez wrapper, you need to install the bluez tools on your machine. No additional python libraries are required. Some distrubutions moved the gatttool binary to a separate package. Make sure you have this binaray available on your machine.
Example to use the bluez/gatttool wrapper:
from mitemp_bt.mitemp_bt_poller import MiTempBtPoller from btlewrap.gatttool import GatttoolBackend poller = MiTempBtPoller('some mac address', GatttoolBackend)
To use the bluepy library you have to install it on your machine, in most cases this can be done via:
pip3 install bluepy
Example to use the bluepy backend:
from mitemp_bt.mitemp_bt_poller import MiTempBtPoller from btlewrap.bluepy import BluepyBackend poller = MiTempBtPoller('some mac address', BluepyBackend)
This device needs notification support from the underlying backend in btlewrap. Currently only Gatttool or Bluepy provide this possibility. Pygatt is therefore not supported. PRs to enhance btlewrap library's pygatt support should be directed to: https://github.com/ChristianKuehnel/btlewrap
please have a look at CONTRIBUTING.md