Skip to main content

Library to read data from Mi Flora sensor

Project description

miflora - Library for Xiaomi Mi plant sensor

PyPI PyPI PyPI Travis Coveralls github Plants healty and growing GitHub license

This library lets you read sensor data from a Xiaomi Mi Flora plant sensor.

Functionality

It supports reading the different measurements from the sensor

  • temperature
  • moisture
  • conductivity
  • brightness

To use this library you will need a Bluetooth Low Energy dongle attached to your computer. You will also need a Xiaomi Mi Flora plant sensor.

Backends

As there is unfortunately no universally working Bluetooth Low Energy library for Python, the project currently offers support for two Bluetooth implementations:

  • bluepy library
  • bluez tools (via a wrapper around gatttool)
  • pygatt library

bluepy

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 miflora.miflora_poller import MiFloraPoller
from btlewrap.bluepy import BluepyBackend

poller = MiFloraPoller('some mac address', BluepyBackend)

This is the backend library to be used.

bluez/gatttool wrapper

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 miflora.miflora_poller import MiFloraPoller
from btlewrap.gatttool import GatttoolBackend

poller = MiFloraPoller('some mac address', GatttoolBackend)

This backend should only be used, if your platform is not supported by bluepy. Note: gatttool is depracated in many Linux distributions.

pygatt

If you have a Blue Giga based device that is supported by pygatt, you have to install the bluepy library on your machine. In most cases this can be done via: pip3 install pygatt

Example to use the pygatt backend:

from miflora.miflora_poller import MiFloraPoller
from btlewrap.pygatt import PygattBackend

poller = MiFloraPoller('some mac address', PygattBackend)

Dependencies

miflora depends on the btlewrap library. If you install miflora via PIP btlewrap will automatically be installed. If not, you will have to install btlewrap manually:

pip3 install btlewrap

Conttributing

please have a look at CONTRIBUTING.md

Projects Depending on miflora

The following shows a selected list of projects using this library:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

miflora-0.5.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file miflora-0.5.tar.gz.

File metadata

  • Download URL: miflora-0.5.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for miflora-0.5.tar.gz
Algorithm Hash digest
SHA256 4417fa91cf893a4f9d846360c38b3be1ef4b9d3f9ddc4bd87891f117eb25aac5
MD5 974635fc53652ca1c7201d89d8daa1a4
BLAKE2b-256 14955b1e133665bea561af50f0ce7b54f1b9e2a90650c9148173ea7fc605529e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page