miflora sensor platform allows one to monitor plant soil and air conditions. The Mi Flora plant sensor is a small Bluetooth Low Energy device that monitors the moisture and conductivity of the soil as well as ambient light and temperature. Since only one BLE device can be polled at a time, the library implements locking to prevent polling more than one device at a time.
There are “Chinese” and “International” versions available and there is a report that only the “International” works.
Before configuring Home Assistant you need a Bluetooth backend and the MAC address of your sensor. Depending on your operating system, you may have to configure the proper Bluetooth backend for your system:
- On Home Assistant: Miflora will work out of the box.
- On Home Assistant Container: Works out of the box with
--net=hostand properly configured Bluetooth on the host.
- On other Linux systems:
- Preferred solution: Install the
bluepylibrary (via pip). When using a virtual environment, make sure to install the library in the right one. - Fallback solution: Install
gatttoolvia your package manager. Depending on the distribution, the package name might be:
- Preferred solution: Install the
Start a scan to determine the MAC addresses of the sensor (you can identify your sensor by looking for
Flower care or
Flower mate entries) using this command:
$ sudo hcitool lescan LE Scan ... F8:04:33:AF:AB:A2 [TV] UE48JU6580 C4:D3:8C:12:4C:57 Flower mate [...]
Or, if your distribution is using bluetoothctl use the following commands:
$ bluetoothctl [bluetooth]# scan on [NEW] Controller <your Bluetooth adapter> [default] [NEW] F8:04:33:AF:AB:A2 [TV] UE48JU6580 [NEW] C4:D3:8C:12:4C:57 Flower mate
If you can’t use
bluetoothctl but have access to an Android phone you can try
BLE Scanner or similar scanner applications from the Play Store to easily find your sensor MAC address. If you are using Windows 10, try the
Microsoft Bluetooth LE Explorer app from the Windows Store.
To use your Mi Flora plant sensor in your installation, add the following to your
# Example configuration.yaml entry sensor: - platform: miflora mac: 'xx:xx:xx:xx:xx:xx' monitored_conditions: - moisture
The parameters that should be monitored.
[“moisture”, “light”, “temperature”, “conductivity”, “battery”]
Sends update events even if the value hasn’t changed.
Sometimes the sensor measurements show spikes. Using this parameter, the poller will report the median of the last 3 (you can also use larger values) measurements. This filters out single spikes. Median: 5 will also filter double spikes. If you never have problems with spikes,
median: 1 will work fine.
Define the Bluetooth adapter to use. Run
hciconfig to get a list of available adapters.
By default the sensor is only polled once every 20 minutes (
scan_interval is 1200 seconds by default). On a Home Assistant restart sensor will report initial value. If you set
median: 3, it will take at least 40 minutes before the sensor will report an average value. Keep in mind though that reducing polling intervals will have a negative effect on the battery life.
A full configuration example could look like the one below:
# Example configuration.yaml entry sensor: - platform: miflora mac: 'xx:xx:xx:xx:xx:xx' name: Flower 1 force_update: true median: 3 go_unavailable_timeout: 43200 monitored_conditions: - moisture - light - temperature - conductivity - battery
An automation example to report a battery failure:
- id: flower1_moisture_unavailable_check alias: Flower 1 sensors available trigger: - entity_id: sensor.flower1_moisture for: 24:00:00 platform: state to: unavailable action: - data: message: "Flower 1 moisture is unavailable for more than 24 hours" service: notify.notifier_telegram_someone