2019-10-16 13:30:31 +02:00
|
|
|
Xiaomi CGG1 BLE Sensor
|
|
|
|
======================
|
2019-10-14 13:25:04 +02:00
|
|
|
|
|
|
|
.. seo::
|
2019-10-16 13:30:31 +02:00
|
|
|
:description: Instructions for setting up Xiaomi ClearGrass CGG1 E-Ink bluetooth-based temperature and humidity sensors in ESPHome.
|
|
|
|
:image: xiaomi_cgg1.jpg
|
|
|
|
:keywords: Xiaomi, ClearGrass, BLE, E-Ink, Bluetooth, CGG1
|
2019-10-14 13:25:04 +02:00
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
The ``xiaomi_cgg1`` sensor platform lets you track the output of Xiaomi CGG1 Bluetooth
|
2019-10-14 13:25:04 +02:00
|
|
|
Low Energy devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
|
2019-10-16 13:30:31 +02:00
|
|
|
temperature, humidity and optionally the battery level of the CGG1 device every time the
|
2019-10-14 13:25:04 +02:00
|
|
|
sensor sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as
|
2019-10-16 13:30:31 +02:00
|
|
|
many CGG1 devices at once as you want.
|
2019-10-14 13:25:04 +02:00
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
.. figure:: images/xiaomi_cgg1-full.jpg
|
2019-10-14 13:25:04 +02:00
|
|
|
:align: center
|
|
|
|
:width: 80.0%
|
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
Xiaomi CGG1 Temperature and Humidity Sensor over BLE.
|
2019-10-14 13:25:04 +02:00
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
.. figure:: images/xiaomi_cgg1-ui.jpg
|
2019-10-14 13:25:04 +02:00
|
|
|
:align: center
|
|
|
|
:width: 80.0%
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
esp32_ble_tracker:
|
|
|
|
|
|
|
|
sensor:
|
2019-10-16 13:30:31 +02:00
|
|
|
- platform: xiaomi_cgg1
|
2019-10-14 13:25:04 +02:00
|
|
|
mac_address: 7A:80:8E:19:36:BA
|
|
|
|
temperature:
|
2019-10-16 13:30:31 +02:00
|
|
|
name: "Xiaomi CGG1 Temperature"
|
2019-10-14 13:25:04 +02:00
|
|
|
humidity:
|
2019-10-16 13:30:31 +02:00
|
|
|
name: "Xiaomi CGG1 Humidity"
|
2019-10-14 13:25:04 +02:00
|
|
|
battery_level:
|
2019-10-16 13:30:31 +02:00
|
|
|
name: "Xiaomi CGG1 Battery Level"
|
2019-10-14 13:25:04 +02:00
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
------------------------
|
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi CGG1 device.
|
2019-10-14 13:25:04 +02:00
|
|
|
- **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>`.
|
|
|
|
|
|
|
|
- **humidity** (*Optional*): The information for the humidity 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>`.
|
|
|
|
|
|
|
|
- **battery_level** (*Optional*): The information for the battery level sensor
|
|
|
|
|
2019-10-30 16:03:39 +01:00
|
|
|
- **name** (**Required**, string): The name for the battery level sensor.
|
2019-10-14 13:25:04 +02:00
|
|
|
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
|
|
|
|
- All other options from :ref:`Sensor <config-sensor>`.
|
|
|
|
|
|
|
|
|
|
|
|
Setting Up Devices
|
|
|
|
------------------
|
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
To set up Xiaomi CGG1 devices you first need to find their MAC Address so that ESPHome can
|
|
|
|
identify them. So first, create a simple configuration without any ``xiaomi_cgg1`` entries
|
2019-10-14 13:25:04 +02:00
|
|
|
like so:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
esp32_ble_tracker:
|
|
|
|
|
|
|
|
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi
|
2019-10-16 13:30:31 +02:00
|
|
|
CGG1. When it detects these sensors, it will automatically parse the BLE message print a
|
2019-10-14 13:25:04 +02:00
|
|
|
message like this one:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
Got Xiaomi CGG1 7A:80:8E:19:36:BA Got temperature=23.4°C, humidity=65.0%
|
2019-10-14 13:25:04 +02:00
|
|
|
|
|
|
|
Note that it can sometimes take some time for the first BLE broadcast to be received. You can speed
|
|
|
|
up the process by pressing the grey bluetooth button on the back of the device.
|
|
|
|
|
2019-10-16 13:30:31 +02:00
|
|
|
Then just copy the address (``7A:80:8E:19:36:BA``) into a new ``sensor.xiaomi_cgg1`` platform
|
2019-10-14 13:25:04 +02:00
|
|
|
entry like in the configuration example at the top.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The ESPHome Xiaomi integration listens passively to packets the xiaomi device sends by itself.
|
|
|
|
ESPHome therefore has no impact on the battery life of the device.
|
|
|
|
|
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
|
|
|
- :doc:`/components/esp32_ble_tracker`
|
2019-10-16 13:30:31 +02:00
|
|
|
- :doc:`/components/sensor/xiaomi_lywsdcgq`
|
|
|
|
- :doc:`/components/sensor/xiaomi_hhccjcy01`
|
2019-10-14 13:25:04 +02:00
|
|
|
- :doc:`/components/sensor/xiaomi_lywsd02`
|
|
|
|
- :doc:`/components/sensor/index`
|
2019-10-16 13:30:31 +02:00
|
|
|
- :apiref:`xiaomi_cgg1/xiaomi_cgg1.h`
|
2019-10-14 13:25:04 +02:00
|
|
|
- `Xiaomi Mijia BLE protocol <https://github.com/mspider65/Xiaomi-Mijia-Bluetooth-Temperature-and-Humidity-Sensor>`__
|
|
|
|
by `@mspider65 <https://github.com/mspider65>`__
|
|
|
|
- `OpenMQTTGateway <https://github.com/1technophile/OpenMQTTGateway>`__ by `@1technophile <https://github.com/1technophile>`__
|
|
|
|
- :ghedit:`Edit`
|