2018-08-22 22:05:28 +02:00
|
|
|
Xiaomi MiFlora BLE Sensor
|
|
|
|
=========================
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
2019-02-16 23:25:23 +01:00
|
|
|
:description: Instructions for setting up Xiaomi Mi Flora bluetooth-based plant monitors in ESPHome.
|
2018-11-14 22:12:27 +01:00
|
|
|
:image: xiaomi_miflora.jpg
|
|
|
|
:keywords: Xiaomi, Mi Flora, BLE, Bluetooth
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
The ``xiaomi_miflora`` sensor platform lets you track the output of Xiaomi MiFlora Bluetooth Low Energy
|
2019-02-07 13:54:45 +01:00
|
|
|
devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
|
2018-08-22 22:05:28 +02:00
|
|
|
temperature, humidity and optionally the battery level of the MiFlora device every time the sensor
|
2019-02-16 23:25:23 +01:00
|
|
|
sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as many
|
2018-11-10 14:31:27 +01:00
|
|
|
MiFlora devices at once as you want.
|
2018-08-22 22:05:28 +02:00
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
esp32_ble_tracker:
|
|
|
|
|
|
|
|
sensor:
|
|
|
|
- platform: xiaomi_miflora
|
|
|
|
mac_address: 94:2B:FF:5C:91:61
|
|
|
|
temperature:
|
|
|
|
name: "Xiaomi MiFlora Temperature"
|
|
|
|
moisture:
|
|
|
|
name: "Xiaomi MiFlora Moisture"
|
|
|
|
illuminance:
|
|
|
|
name: "Xiaomi MiFlora Illuminance"
|
|
|
|
conductivity:
|
|
|
|
name: "Xiaomi MiFlora Soil Conductivity"
|
|
|
|
battery_level:
|
|
|
|
name: "Xiaomi MiFlora Battery Level"
|
|
|
|
|
|
|
|
Configuration variables:
|
2018-08-24 22:44:01 +02:00
|
|
|
------------------------
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi MiFlora device.
|
|
|
|
- **temperature** (*Optional*): The information for the temperature sensor.
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name for the temperature sensor.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
- **moisture** (*Optional*): The information for the moisture sensor
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name for the moisture sensor.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
- **illuminance** (*Optional*): The information for the illuminance sensor
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name for the illuminance sensor.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
- **conductivity** (*Optional*): The information for the soil conductivity sensor
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name for the soil conductivity sensor.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
- **battery_level** (*Optional*): The information for the battery level sensor
|
|
|
|
|
|
|
|
- **name** (**Required**, string): The name for the humidity sensor.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
|
|
|
|
|
|
|
|
|
|
|
|
Setting Up Devices
|
2018-08-24 22:44:01 +02:00
|
|
|
------------------
|
2018-08-22 22:05:28 +02:00
|
|
|
|
2019-01-06 19:01:47 +01:00
|
|
|
Before you can even scan for the MiFlora sensor, you need to activate it using the Flower Care app. Set it up there and you'll be able to discover it.
|
|
|
|
|
2019-02-16 23:25:23 +01:00
|
|
|
To set up Xiaomi MiFlora devices you first need to find their MAC Address so that ESPHome can
|
2018-08-22 22:05:28 +02:00
|
|
|
identify them. So first, create a simple configuration without any ``xiaomi_miflora`` entries like so:
|
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
esp32_ble_tracker:
|
|
|
|
|
|
|
|
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi MiFlora. When
|
|
|
|
it detects these sensors, it will automatically parse the BLE message print a message like this one:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
Xiaomi MiFlora 94:2B:FF:5C:91:61 Got temperature=23.4°C
|
|
|
|
|
|
|
|
Note that it can sometimes take some time for the first BLE broadcast to be received.
|
|
|
|
|
|
|
|
Then just copy the address (``94:2B:FF:5C:91:61``) into a new ``sensor.xiaomi_miflora`` platform entry like
|
|
|
|
in the configuration example at the top.
|
|
|
|
|
|
|
|
|
|
|
|
See Also
|
2018-08-24 22:44:01 +02:00
|
|
|
--------
|
2018-08-22 22:05:28 +02:00
|
|
|
|
2019-02-07 13:54:45 +01:00
|
|
|
- :doc:`/components/esp32_ble_tracker`
|
|
|
|
- :doc:`/components/sensor/xiaomi_mijia`
|
|
|
|
- :doc:`/components/sensor/index`
|
|
|
|
- :apiref:`esp32_ble_tracker.h`
|
2018-08-24 22:44:01 +02:00
|
|
|
- `OpenMQTTGateway <https://github.com/1technophile/OpenMQTTGateway>`__ by `@1technophile <https://github.com/1technophile>`__
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|
2018-10-12 16:33:22 +02:00
|
|
|
|
|
|
|
.. disqus::
|