Skip to main content

plantgateway

Bluetooth LE to mqtt gateway for Xiaomi Mi plant sensors. For more details see the documentation overview.

Use case

For many setups the Xiaomi Mi plant sensors are too far away from your home server to connect directly via Bluetooth LE. In such a scenario the plantgatway will poll the data from a list of Xiaomi Mi plant sensors via Bluetooth LE using miflora. The data is then published via mqtt to your home automation server.

The plantgateway is intended to be run on a small Linux machine (e.g. Raspberry Pi or a C.H.I.P) that has both Bluetooth LE and WiFi.

installation & update

sudo apt-get install python3-pip build-essential libglib2.0-dev libyaml-dev
  • install the plant gateway from pypi:
sudo pip install --upgrade plantgateway

or if you have multiple python and pip installations:

sudo pip3 install --upgrade plantgateway
  • To update your installation just run pip again.

If you have problems with the PyYaml installation, update your pip version with sudo pip3 install --upgrade pip and try again.

configuration

Copy the plantgw.yaml (in this repository) to your home directory and rename it to ".plantgw.yaml". Then change this file to match your requirements.

execution

After the installation with pip you can simply run the tool from the command line:

plantgateway

There are no command line parameters and there is no interaction required. You probably want to add the script to your cron tab to be executed in regular intervals (e.q. every hour).

integration in home automation

HomeAssistant

If you enable the MQTT discovery feature by setting the discovery_prefix parameter in the config file, all configured sensors are automatically available in HomeAssistant. To monitor the state of your plants, you can use the "plant" component.

fhem

To check your plants in the home automation tool fhem, you can use the gardener module. The installation is explained on the github page of the module.

If you haven't done so, you need to configure your MQTT server in fhem with a MQTT module. For each sensor you have, set up a MQTT_Device and make it auto subscribe to the topic you configured in the plantgateway:

define <plant_name> MQTT_Device
attr <plant_name> autoSubscribeReadings <prefix_in_config>/<plant alias>/+

After that configure the gardener to match your requirements

Security

A remark on security: Before running your MQTT server on the internet make sure that you enable SSL/TLS encryption and client authentication.

Problem analysis

In case you have any problem with plantgateway, please check:

  • Is you configuration file a valid YAML file?
  • Does your Bluetooth dongle support Bluetooh Low Energy? Check with sudo hcitool lescan, this should list all Low Energy devices.
  • If you have connection issues, please try a system update sudo apt update; sudo apt dist-upgrade. This fixes these issues usually.

If all this does not help, please file a bug ticket in github.

License

Unless stated otherwise all software in this repository is licensed under the Apache License 2.0 http://www.apache.org/licenses/LICENSE-2.0

Metadata

Release files for plantgateway 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plantgateway 0.7.0
File Size Uploaded
plantgateway-0.7.0.tar.gz 6.5 kB Details

Release files / plantgateway-0.7.0.tar.gz

Download URL plantgateway-0.7.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
880866ea573d6a81caf0e753ed681e8019afb97d177bdb50719f4bceb5591019
BLAKE2b-256 checksum
How to use checksums
44e6a9339069eff2094a284a3b48001125a42f9660083266928736b5137e6825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.7.0 This release

1 release file

0.6.2

2 release files

0.6.0

1 release file

0.5.1

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.8

1 release file

0.3.7

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page