From 13c0bc7aacacc29ec7993f6bbd34a4b44ef6fd77 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 27 Oct 2020 17:35:41 +0100 Subject: [PATCH 1/5] Add battery support for LYWSD02 --- custom_components/mitemp_bt/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/mitemp_bt/const.py b/custom_components/mitemp_bt/const.py index b5f1824d6..ddbdf5872 100644 --- a/custom_components/mitemp_bt/const.py +++ b/custom_components/mitemp_bt/const.py @@ -63,7 +63,7 @@ 'GCLS002' : [0, 9, 1, 2, 3, 9, 9, 9, 9], 'HHCCPOT002': [9, 9, 0, 1, 9, 9, 9, 9, 9], 'LYWSDCGQ' : [0, 1, 9, 9, 9, 9, 9, 9, 2], - 'LYWSD02' : [0, 1, 9, 9, 9, 9, 9, 9, 9], + 'LYWSD02' : [0, 1, 9, 9, 9, 9, 9, 9, 2], 'CGG1' : [0, 1, 9, 9, 9, 9, 9, 9, 2], 'LYWSD03MMC': [0, 1, 9, 9, 9, 9, 9, 9, 2], 'CGD1' : [0, 1, 9, 9, 9, 9, 9, 9, 2], From 3263aecf4565e8098adfc432b5468b3bd6a8e774 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 27 Oct 2020 19:42:08 +0100 Subject: [PATCH 2/5] Update battery level support for LYWSD02 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d9e46e085..94a2f6c07 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This custom component is an alternative for the standard build in [mitemp_bt](ht - LYWSD02 - (rectangular body, E-Ink, broadcasts temperature and humidity, about 20 readings per minute, no battery info) + (rectangular body, E-Ink, broadcasts temperature, humidity and battery level (battery level is available for firmware version 1.1.2_00085 and later), about 20 readings per minute) ![LYWSD02](/pictures/LYWSD02.jpeg) From a3977efd9be416b6e4303c4fcdcd762c8aeff0cd Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 27 Oct 2020 19:47:20 +0100 Subject: [PATCH 3/5] Release notes 0.7.6 battery support LYWSD02 --- info.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/info.md b/info.md index 3c0db1714..18483876e 100644 --- a/info.md +++ b/info.md @@ -18,19 +18,9 @@ Changes were based on a small part of the changes as proposed in beta 0.7.1 by @ {% endif %} {% if installed or pending_update %} -# Changes in 0.7.5 +# Changes in 0.7.6 -Fix typo in formaldehyde sensor (by @MarpleA) - -# Changes in 0.7.4 - -This time, only some code optimization, reducing the number of lines of python code with about 20%. - -- Adding a MeasuringSensor class which is used for all measuring sensors, to shorten the python code (won't affect users) -- Adding device_class Illuminance to illuminance sensors (will change the icon to default Home Asssistant icon) -- Using default unit of measurements from Home Assistant constants (won't affect users) - -Changes were based on a small part of the changes as proposed in beta 0.7.1 by @Magalex2x14, further developed by me (@Ernst79). +Added battery level support for LYWSD02 sensor. Note that battery level is only supported for LYWSD02 sensors with firmware 1.1.2_00085 or later. {% endif %} @@ -69,7 +59,7 @@ This custom component is an alternative for the standard build in [mitemp_bt](ht - LYWSD02 - (rectangular body, E-Ink, broadcasts temperature and humidity, about 20 readings per minute, no battery info) + (rectangular body, E-Ink, broadcasts temperature, humidity and battery level, about 20 readings per minute. Battery level is available for firmware version 1.1.2_00085 and later.) From f0dffa1f7e2effcadcb28697832cfa7c2aa5d001 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 27 Oct 2020 19:59:59 +0100 Subject: [PATCH 4/5] Update faq --- faq.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/faq.md b/faq.md index 94c77cb35..64a334110 100644 --- a/faq.md +++ b/faq.md @@ -16,6 +16,7 @@ - [Conflicts with other components using the same BT interface](#conflicts-with-other-components-using-the-same-bt-interface) - [My sensor stops receiving updates some time after the system restart](#my-sensor-stops-receiving-updates-some-time-after-the-system-restart) - [My sensor from the Xiaomi ecosystem is not in the list of supported ones. How to request implementation?](#my-sensor-from-the-xiaomi-ecosystem-is-not-in-the-list-of-supported-ones-how-to-request-implementation) + - [My sensor isn't showing the battery level](#my-sensor-isnt-showing-the-battery-level) - [TIPS AND TRICKS](#tips-and-tricks) - [How to know exactly if the reception of data from my sensors has stopped?](#how-to-know-exactly-if-the-reception-of-data-from-my-sensors-has-stopped) - [DEBUG](#debug) @@ -86,21 +87,21 @@ Devices: ### How can I create a battery sensor? -You can create a battery sensor by using a template sensor. Add the following to your `configuration.yaml`. Make sure you adjust the name of the sensor with your own sensor. +You can set option `batt_entities` to `True` - the battery sensor entity will be created automatically for each device reporting battery status. + +Or you can create a battery sensor by using a template sensor. Add the following to your `configuration.yaml`. Make sure you adjust the name of the sensor with your own sensor. ```yaml sensor: - platform: template sensors: - mi_b_582d34339449: + mi_battery_582d34339449: friendly_name: "Battery" unit_of_measurement: "%" - value_template: "{{ state_attr('sensor.mi_t_582d34339449', 'battery_level') }}" + value_template: "{{ state_attr('sensor.mi_temperature_582d34339449', 'battery_level') }}" device_class: "battery" ``` -Or (since v0.5.4) you can set option `batt_entities` to `True` - the battery sensor entity will be created automatically for each device reporting battery status. - ## RECEPTION ISSUES ### My sensor doesn't receive any readings from my sensors anymore or only occasionally @@ -189,6 +190,10 @@ logger: - Do not forget to disable the `report_unknown` option (delete it or set it to `False` and restart HA)! Since the potentially large output of this option will spam the log and can mask really important messages. - Wait for a response from the developers. +### My sensor isn't showing the battery level + +Battery level is not broadcasted by all sensors. Check the list of supported sensors to see if your sensor supports battery level. [supported sensors](https://github.com/custom-components/sensor.mitemp_bt/blob/master/README.md#supported-sensors) + ## TIPS AND TRICKS ### How to know exactly if the reception of data from my sensors has stopped? From e981903516f8497edb6960f257a78dbf212fcf74 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 27 Oct 2020 20:01:25 +0100 Subject: [PATCH 5/5] update faq part 2 --- faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faq.md b/faq.md index 64a334110..1199e77ca 100644 --- a/faq.md +++ b/faq.md @@ -192,7 +192,7 @@ logger: ### My sensor isn't showing the battery level -Battery level is not broadcasted by all sensors. Check the list of supported sensors to see if your sensor supports battery level. [supported sensors](https://github.com/custom-components/sensor.mitemp_bt/blob/master/README.md#supported-sensors) +Battery level is not broadcasted by all sensors. Check the list of [supported sensors](https://github.com/custom-components/sensor.mitemp_bt/blob/master/README.md#supported-sensors) to see if your sensor supports battery level. LYWSD02 sensors need to be updated to firmware 1.1.2_00085 or above to the show battery level. ## TIPS AND TRICKS