Add support for additional Xiaomi BLE sensors (#576) (#576)

This commit is contained in:
Alexander Pohl 2020-05-27 00:33:46 +02:00 committed by GitHub
parent ab6de0fb7f
commit d95759f853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 368 additions and 415 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,362 @@
Xiaomi Mijia BLE Sensors
========================
.. seo::
:description: Instructions for setting up Xiaomi Mi Home (Mijia) bluetooth-based sensors in ESPHome.
:image: xiaomi_mijia_logo.jpg
:keywords: Xiaomi, Mi Home, Mijia, BLE, Bluetooth, HHCCJCY01, GCLS002, HHCCPOT002, LYWSDCGQ, LYWSD02, CGG1, LYWSD03MMC, CGD1, JQJCY01YM, MUE4094RT, WX08ZM
The ``xiaomi_ble`` sensor platform lets you track the output of Xiaomi Bluetooth Low Energy devices using the :doc:`/components/esp32_ble_tracker`. This component will track, for example, the temperature, humidity, moisture, conductivity, illuminance, formaldehyde, mosquito tablet and battery level of the device every time the sensor sends out a BLE broadcast. Contrary to other implementations, ``xiaomi_ble`` listense passively to advertisement packets and does not pair with the device. Hence ESPHome has no impact on battery life.
Supported Devices
-----------------
HHCCJCY01
*********
MiFlora, Huahuacaocao, measures temperature, moisture, ambient light and nutrient levels in the soil.
.. figure:: images/xiaomi_hhccjcy01.jpg
:align: center
:width: 60.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_hhccjcy01
mac_address: '94:2B:FF:5C:91:61'
temperature:
name: "Xiaomi HHCCJCY01 Temperature"
moisture:
name: "Xiaomi HHCCJCY01 Moisture"
illuminance:
name: "Xiaomi HHCCJCY01 Illuminance"
conductivity:
name: "Xiaomi HHCCJCY01 Soil Conductivity"
battery_level:
name: "Xiaomi HHCCJCY01 Battery Level"
GCLS002
*******
VegTrug Grow Care Garden, Takasho, suitable for outside, similar to the MiFlora.
.. figure:: images/xiaomi_gcls002.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_gcls002
mac_address: "94:2B:FF:5C:91:61"
temperature:
name: "GCLS02 Temperature"
moisture:
name: "GCLS02 Moisture"
conductivity:
name: "GCLS02 Soil Conductivity"
illuminance:
name: "GCLS02 Illuminance"
HHCCPOT002
**********
FlowerPot, Huahuacaocao, RoPot, broadcasts moisture and conductivity
.. figure:: images/xiaomi_hhccpot002.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_hhccpot002
mac_address: "94:2B:FF:5C:91:61"
moisture:
name: "HHCCPOT002 Moisture"
conductivity:
name: "HHCCPOT002 Soil Conductivity"
LYWSDCGQ
********
Hygro thermometer, round body, segment LCD, broadcasts temperature, humidity and battery level.
.. figure:: images/xiaomi_lywsdcgq.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_lywsdcgq
mac_address: "7A:80:8E:19:36:BA"
temperature:
name: "LYWSDCGQ Temperature"
humidity:
name: "LYWSDCGQ Humidity"
battery_level:
name: "LYWSDCGQ Battery Level"
LYWSD02
*******
Hygro thermometer, rectangular body, e-ink display, broadcasts temperature and humidity values, no battery status
.. figure:: images/xiaomi_lywsd02.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_lywsd02
mac_address: "3F:5B:7D:82:58:4E"
temperature:
name: "LYWSD02 Temperature"
humidity:
name: "LYWSD02 Humidity"
CGG1
****
Hygro thermometer, round body, e-ink display
.. figure:: images/xiaomi_cgg1.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_cgg1
mac_address: "7A:80:8E:19:36:BA"
temperature:
name: "CGG1 Temperature"
humidity:
name: "CGG1 Humidity"
battery_level:
name: "CGG1 Battery Level"
LYWSD03MMC
**********
Hygro thermometer, small square body, segment LCD, encrypted, broadcasts temperature, humidity and battery status. Requires a bindkey in order to decrypt the received data (see :ref:`obtaining_the_bindkey`).
.. figure:: images/xiaomi_lywsd03mmc.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_lywsd03mmc
mac_address: "A4:C1:38:B1:CD:7F"
bindkey: "eef418daf699a0c188f3bfd17e4565d9"
temperature:
name: "LYWSD03MMC Temperature"
humidity:
name: "LYWSD03MMC Humidity"
battery_level:
name: "LYWSD03MMC Battery Level"
CGD1
****
Cleargrass (Qingping) alarm clock, segment LCD, encrypted, broadcasts temperature, humidity and battery status. Requires a bindkey in order to decrypt the received data (see :ref:`obtaining_the_bindkey`).
.. figure:: images/xiaomi_cgd1.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_cgd1
mac_address: "A4:C1:38:8C:34:B7"
bindkey: "fe39106baeedb7c801e3d63c4396f97e"
temperature:
name: "CGD1 Temperature"
humidity:
name: "CGD1 Humidity"
battery_level:
name: "CGD1 Battery Level"
JQJCY01YM
*********
Xiaomi (Honeywell) formaldehyde sensor, OLED display, broadcasts temperature, humidity, formaldehyde concentration (mg/m³) and battery status.
.. figure:: images/xiaomi_jqjcy01ym.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
- platform: xiaomi_jqjcy01ym
mac_address: "7A:80:8E:19:36:BA"
temperature:
name: "JQJCY01YM Temperature"
humidity:
name: "JQJCY01YM Humidity"
formaldehyde:
name: "JQJCY01YM Formaldehyde"
battery_level:
name: "JQJCY01YM Battery Level"
WX08ZM
******
Mosquito Repellent Smart Version, broadcasts the tablet resource level, on/off state and battery level, implemented as a hybrid sensor, needs both ``sensor`` and ``binary_sensor`` in config.
.. figure:: images/xiaomi_wx08zm.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
binary_sensor:
- platform: xiaomi_wx08zm
mac_address: "74:a3:4a:b5:07:34"
tablet:
name: "WX08ZM Mosquito Tablet"
battery_level:
name: "WX08ZM Battery Level"
MUE4094RT
*********
Xiaomi Philips BLE night light, broadcasts motion detection (detected/clear, on/off), default timeout is 5s, implemented as a hybrid sensor, needs both ``sensor`` and ``binary_sensor`` in config.
.. figure:: images/xiaomi_mue4094rt.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
binary_sensor:
- platform: xiaomi_mue4094rt
name: "MUE4094RT Night Light"
mac_address: "7A:80:8E:19:36:BA"
timeout: "5s"
MJYD02YL-A
**********
Xiaomi Yeelight night light, in-shape replacement of MJYD02YL with BLE, broadcasts light on/off status, motion detection, idle time since last motion event and battery status. Requires a bindkey in order to decrypt the received data (see :ref:`obtaining_the_bindkey`). Implemented as a hybrid sensor, needs both ``sensor`` and ``binary_sensor`` in config.
.. figure:: images/xiaomi_mjyd02yla.jpg
:align: center
:width: 30.0%
Configuration example:
.. code-block:: yaml
sensor:
binary_sensor:
- platform: xiaomi_mjyd02yla
name: "MJYD02YL-A Night Light"
mac_address: "50:EC:50:CD:32:02"
bindkey: "48403ebe2d385db8d0c187f81e62cb64"
idle_time:
name: "MJYD02YL-A Idle Time"
light:
name: "MJYD02YL-A Light Status"
battery_level:
name: "MJYD02YL-A Battery Level"
Setting Up Devices
------------------
Required:
- **mac_address** (MAC Address): The MAC address of the device.
- **bindkey** (string, 32 characters, case insensitive): The key to decrypt the BLE advertisements for encrypted sensor types
Optional with **name**, **id** (:ref:`config-id`) and all other options from :ref:`Sensor <config-sensor>`:
- **temperature**
- **humidity**
- **moisture**
- **illuminance**
- **conductivity**
- **tablet**
- **formaldehyde**
- **battery_level**
To find the MAC Address so that ESPHome can identify the device, you can create a simple configuration without any sensor entries:
.. code-block:: yaml
esp32_ble_tracker:
After uploading, the ESP32 will immediately try to scan for BLE devices. When it detects a new sensor, it will automatically parse the BLE message print a message like this one:
.. code::
Found device A4:C1:38:4E:16:78 RSSI=-78
Address Type: PUBLIC
Name: 'LYWSD03MMC'
It can sometimes take some time for the first BLE broadcast to be received. Once the device has been found, copy the address ``A4:C1:38:4E:16:78`` into a new platform entry like shown in the example configurations.
.. _obtaining_the_bindkey:
Obtaining The Bindkey
---------------------
To set up an encrypted device such as the LYWSD03MMC or CGD1, you first need to obain the bind key. The ``xiaomi_ble`` sensor component is not able to automatically generate a bind key, so you need to use the original Mi Home app to add the sensor once (there are `efforts <https://github.com/danielkucera/mi-standardauth>`__ to generate a bindkey without the need for packet sniffing, but it's not working correctly yet). While adding the device, a new key is generated and uploaded into the Xiaomi cloud and to the device itself. Currently a chinese server needs to be selected as the rest of the world doesn't support most of these devices yet. Once generated, the key will not change again until the device is removed and re-added in the Xiaomi app.
In order to obtain the bind key, a SSL packet sniffer needs to be setup on either an Android phone or the iPhone. A good choice for Android is the `Remote PCAP <https://play.google.com/store/apps/details?id=com.egorovandreyrm.pcapremote&hl=en>`__ in combination with `Wireshark <https://www.wireshark.org/>`__. A tutorial on how to setup the Remote PCAP packet sniffer can be found `here <https://egorovandreyrm.com/pcap-remote-tutorial/>`__. Instructions how to obtain the key using an iPhone are `here <https://github.com/custom-components/sensor.mitemp_bt/blob/master/faq.md#my-sensors-ble-advertisements-are-encrypted-how-can-i-get-the-key>`__. Once the traffic between the Mi Home app and the Xiaomi has been recorded, the bind key will show in clear text:
.. code-block:: yaml
packet: POST /app/device/bltbind
"data" = "{"did":"blt.3.129q4nasgeg00","token":"20c665a7ff82a5bfb5eefc36","props":[{"type":"prop","key":"bind_key","value":"cfc7cc892f4e32f7a733086cf3443cb0"}, {"type":"prop","key":"smac","value":"A4:C1:38:8C:34:B7"}]}"
The ``bind_key`` is the 32 digits "value" item in the above output which needs to be inserted into the config file.
See Also
--------
- :doc:`/components/esp32_ble_tracker`
- :doc:`/components/sensor/index`
- :apiref:`xiaomi_lywsd03mmc/xiaomi_ble.h`
- Xiaomi Home Assistant mitemp_bt custom component `<https://github.com/custom-components/sensor.mitemp_bt>`__
by `@Magalex2x14 <https://github.com/Magalex2x14>`__
- Xiaomi LYWSD03MMC passive sensor readout `<https://github.com/ahpohl/xiaomi_lywsd03mmc>`__ by `@ahpohl <https://github.com/ahpohl>`__
- Mi-standardauth `<https://github.com/danielkucera/mi-standardauth>`__
- :ghedit:`Edit`

View File

@ -1,105 +0,0 @@
Xiaomi CGG1 BLE Sensor
======================
.. seo::
: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
The ``xiaomi_cgg1`` sensor platform lets you track the output of Xiaomi CGG1 Bluetooth
Low Energy devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
temperature, humidity and optionally the battery level of the CGG1 device every time the
sensor sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as
many CGG1 devices at once as you want.
.. figure:: images/xiaomi_cgg1-full.jpg
:align: center
:width: 80.0%
Xiaomi CGG1 Temperature and Humidity Sensor over BLE.
.. figure:: images/xiaomi_cgg1-ui.jpg
:align: center
:width: 80.0%
.. code-block:: yaml
# Example configuration entry
esp32_ble_tracker:
sensor:
- platform: xiaomi_cgg1
mac_address: 7A:80:8E:19:36:BA
temperature:
name: "Xiaomi CGG1 Temperature"
humidity:
name: "Xiaomi CGG1 Humidity"
battery_level:
name: "Xiaomi CGG1 Battery Level"
Configuration variables:
------------------------
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi CGG1 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>`.
- **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
- **name** (**Required**, string): The name for the battery level sensor.
- **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
------------------
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
like so:
.. code-block:: yaml
esp32_ble_tracker:
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi
CGG1. When it detects these sensors, it will automatically parse the BLE message print a
message like this one:
.. code::
Got Xiaomi CGG1 7A:80:8E:19:36:BA Got temperature=23.4°C, humidity=65.0%
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.
Then just copy the address (``7A:80:8E:19:36:BA``) into a new ``sensor.xiaomi_cgg1`` platform
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`
- :doc:`/components/sensor/xiaomi_lywsdcgq`
- :doc:`/components/sensor/xiaomi_hhccjcy01`
- :doc:`/components/sensor/xiaomi_lywsd02`
- :doc:`/components/sensor/index`
- :apiref:`xiaomi_cgg1/xiaomi_cgg1.h`
- `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`

View File

@ -1,113 +1,3 @@
Xiaomi HHCCJCY01 BLE Sensor
===========================
HHCCJCY01 Moved To Xiaomi BLE
=============================
.. seo::
:description: Instructions for setting up Xiaomi Mi Flora HHCCJCY01 bluetooth-based plant monitors in ESPHome.
:image: xiaomi_hhccjcy01.jpg
:keywords: Xiaomi, Mi Flora, BLE, Bluetooth, HHCCJCY01
The ``xiaomi_hhccjcy01`` sensor platform lets you track the output of Xiaomi HHCCJCY01 Bluetooth Low Energy
devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
temperature, humidity and optionally the battery level of the HHCCJCY01 device every time the sensor
sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as many
HHCCJCY01 devices at once as you want.
.. code-block:: yaml
# Example configuration entry
esp32_ble_tracker:
sensor:
- platform: xiaomi_hhccjcy01
mac_address: '94:2B:FF:5C:91:61'
temperature:
name: "Xiaomi HHCCJCY01 Temperature"
moisture:
name: "Xiaomi HHCCJCY01 Moisture"
illuminance:
name: "Xiaomi HHCCJCY01 Illuminance"
conductivity:
name: "Xiaomi HHCCJCY01 Soil Conductivity"
battery_level:
name: "Xiaomi HHCCJCY01 Battery Level"
Configuration variables:
------------------------
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi HHCCJCY01 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>`.
- **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>`.
- **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>`.
- **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>`.
- **battery_level** (*Optional*): The information for the battery level sensor
- **name** (**Required**, string): The name for the battery sensor.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>`.
.. note::
This integration requires the device to have a recent firmware version, see
https://github.com/esphome/issues/issues/260#issuecomment-487684720 for more info.
The ``battery_level`` does not appear to work with some firmware versions of the device (the other sensors
do work though). See https://github.com/esphome/issues/issues/107 for more information.
Setting Up Devices
------------------
Before you can even scan for the sensor, you need to activate it using the Flower Care app. Set it up there and you'll be able to discover it.
To set up Xiaomi HHCCJCY01 devices you first need to find their MAC Address so that ESPHome can
identify them. So first, create a simple configuration without any ``xiaomi_hhccjcy01`` entries like so:
.. code-block:: yaml
esp32_ble_tracker:
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi HHCCJCY01. When
it detects these sensors, it will automatically parse the BLE message print a message like this one:
.. code::
Got Xiaomi HHCCJCY01 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_hhccjcy01`` platform 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`
- :doc:`/components/sensor/xiaomi_lywsdcgq`
- :doc:`/components/sensor/index`
- :apiref:`xiaomi_hhccjcy01/xiaomi_hhccjcy01.h`
- `OpenMQTTGateway <https://github.com/1technophile/OpenMQTTGateway>`__ by `@1technophile <https://github.com/1technophile>`__
- :ghedit:`Edit`

View File

@ -1,93 +0,0 @@
Xiaomi LYWSD02 BLE Sensor
=========================
.. seo::
:description: Instructions for setting up Xiaomi LYWSD02 bluetooth-based temperature and humidity sensors in ESPHome.
:image: xiaomi_lywsd02.jpg
:keywords: Xiaomi, LYWSD02, BLE, Bluetooth
The ``xiaomi_lywsd02`` sensor platform lets you track the output of Xiaomi LYWSD02 Bluetooth Low Energy
devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
temperature, humidity of the LYWSD02 device every time the sensor
sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as many
LYWSD02 devices at once as you want.
.. figure:: images/xiaomi_lywsd02-full.png
:align: center
:width: 60.0%
Xiaomi LYWSD02 Temperature and Humidity Sensor over BLE.
.. figure:: images/xiaomi_lywsd02-ui.png
:align: center
:width: 80.0%
.. code-block:: yaml
# Example configuration entry
esp32_ble_tracker:
sensor:
- platform: xiaomi_lywsd02
mac_address: 3F:5B:7D:82:58:4E
temperature:
name: "Xiaomi LYWSD02 Temperature"
humidity:
name: "Xiaomi LYWSD02 Humidity"
Configuration variables:
------------------------
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi LYWSD02 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>`.
- **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>`.
Setting Up Devices
------------------
To set up Xiaomi LYWSD02 devices you first need to find their MAC Address so that ESPHome can
identify them. So first, create a simple configuration without any ``xiaomi_lywsd02`` entries like so:
.. code-block:: yaml
esp32_ble_tracker:
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi LYWSD02. When
it detects these sensors, it will automatically parse the BLE message print a message like this one:
.. code::
Got Xiaomi LYWSD02 (3F:5B:7D:82:58:4E): Temperature: 26.9°C
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.
Then just copy the address (``3F:5B:7D:82:58:4E``) into a new ``sensor.xiaomi_lywsd02`` platform 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`
- :doc:`/components/sensor/xiaomi_lywsdcgq`
- :doc:`/components/sensor/xiaomi_hhccjcy01`
- :doc:`/components/sensor/index`
- :apiref:`xiaomi_lywsd02/xiaomi_lywsd02.h`
- `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`

View File

@ -1,101 +1,3 @@
Xiaomi LYWSDCGQ BLE Sensor
==========================
LYWSDCGQ Moved To Xiaomi BLE
============================
.. seo::
:description: Instructions for setting up Xiaomi Mi Jia LYWSDCGQ bluetooth-based temperature and humidity sensors in ESPHome.
:image: xiaomi_lywsdcgq.jpg
:keywords: Xiaomi, Mi Jia, BLE, Bluetooth, LYWSDCGQ
The ``xiaomi_lywsdcgq`` sensor platform lets you track the output of Xiaomi LYWSDCGQ Bluetooth Low Energy
devices using the :doc:`/components/esp32_ble_tracker`. This component will track the
temperature, humidity and optionally the battery level of the device every time the sensor
sends out a BLE broadcast. Note that contrary to other implementations, ESPHome can track as many
LYWSDCGQ devices at once as you want.
.. figure:: images/xiaomi_lywsdcgq-full.jpg
:align: center
:width: 60.0%
Xiaomi Temperature and Humidity Sensor over BLE.
.. figure:: images/xiaomi_lywsdcgq-ui.png
:align: center
:width: 80.0%
.. code-block:: yaml
# Example configuration entry
esp32_ble_tracker:
sensor:
- platform: xiaomi_lywsdcgq
mac_address: 7A:80:8E:19:36:BA
temperature:
name: "Xiaomi LYWSDCGQ Temperature"
humidity:
name: "Xiaomi LYWSDCGQ Humidity"
battery_level:
name: "Xiaomi LYWSDCGQ Battery Level"
Configuration variables:
------------------------
- **mac_address** (**Required**, MAC Address): The MAC address of the Xiaomi LYWSDCGQ 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>`.
- **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
- **name** (**Required**, string): The name for the battery level sensor.
- **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
------------------
To set up Xiaomi LYWSDCGQ devices you first need to find their MAC Address so that ESPHome can
identify them. So first, create a simple configuration without any ``xiaomi_lywsdcgq`` entries like so:
.. code-block:: yaml
esp32_ble_tracker:
After uploading the ESP32 will immediately try to scan for BLE devices such as the Xiaomi LYWSDCGQ. When
it detects these sensors, it will automatically parse the BLE message print a message like this one:
.. code::
Got Xiaomi LYWSDCGQ 7A:80:8E:19:36:BA Got temperature=23.4°C, humidity=65.0%
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.
Then just copy the address (``7A:80:8E:19:36:BA``) into a new ``sensor.xiaomi_lywsdcgq`` platform 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`
- :doc:`/components/sensor/xiaomi_hhccjcy01`
- :doc:`/components/sensor/index`
- :apiref:`xiaomi_lywsdcgq/xiaomi_lywsdcgq.h`
- `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`

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -160,10 +160,7 @@ Sensor Components
Uptime Sensor, components/sensor/uptime, timer.svg
VL53L0x, components/sensor/vl53l0x, vl53l0x.svg
WiFi Signal Strength, components/sensor/wifi_signal, network-wifi.svg
Xiaomi CGG1, components/sensor/xiaomi_cgg1, xiaomi_cgg1.jpg
Xiaomi HHCCJCY01, components/sensor/xiaomi_hhccjcy01, xiaomi_hhccjcy01.jpg
Xiaomi LYWSD02, components/sensor/xiaomi_lywsd02, xiaomi_lywsd02.jpg
Xiaomi LYWSDCGQ, components/sensor/xiaomi_lywsdcgq, xiaomi_lywsdcgq.jpg
Xiaomi BLE, components/sensor/xiaomi_ble, xiaomi_mijia_logo.jpg
ZyAura, components/sensor/zyaura, zgm053.jpg
Custom Sensor, components/sensor/custom, language-cpp.svg

View File

@ -1 +1 @@
sphinx==1.8.4
sphinx>=1.8.4