Releases: mmakaay/esphome-xiaomi_bslamp2
Support for Home Assistant Color Modes
Home Assistant 2021.8.0 introduced support for Color Modes in the ESPHome integration.
This release implements the required compatibility for this.
The code for this release depends on upcoming changes in ESPHome, which will be available from v1.21.0 on. Because that version is still in development, this release is published as a release candidate, so people with bleeding edge setups can test this.
v1.1.0
Today, ESPHome v1.20.0 was released.
It contains a couple of changes that I was waiting for before declaring the v1.1.0 release stable.
The main changes for this release:
- It is now possible to address the LEDs in the front panel of the device individually.
- Implemented support for visual feedback during the OTA update process in the example.yaml file.
- Made it possible to use lambdas with the preset.activate automation
See the CHANGELOG.md in the repo for a full list of changes.
Upgrading an existing lamp
When you want to upgrade, then make sure that you are running ESPHome v1.20.0 or later.
In the YAML configuration, it is best to use ref: v1.1.0
explicitly to make use of this release.
external_components:
- source:
type: git
url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
ref: v1.1.0
You could also use ref: main
, but when doing so, beware that ESPHome might be running
off an older version of the code, because external_components:
doesn't currently pull fresh
code from GitHub when starting a compile.
Individually controllable LEDs for thte front panel illumination
This version of the code requires ESPHome v1.19.0 or newer to work.
It brings new functionality that makes it possible to control the LEDs of the front panel individually (power button, color button and 10 slider levels). This means that you have 12 LEDs in total to use as you see fit, instead of sticking with the behavior of the original firmware.
Documentation for the new feature can be found here:
https://github.com/mmakaay/esphome-xiaomi_bslamp2/blob/main/doc/configuration.md#addressing-the-leds-of-the-illumination-individually
For a little demo, see:
https://www.youtube.com/watch?v=nKwnJPETUdw
In this video, you will see that the brightness slider is not filled in from zero up to the active brightness level, but instead only shows a marker at the current brightness. Furthermore, a fun little animation was added when turning off the lamp.
Compatibility with ESPHome v1.19.0
Due to some internal changes in the ESPHome code, the Bedside Lamp 2 code did not compile anymore. This release updates the code to be compatible with ESPHome v1.19.0 (which is from now on also the minimal version of ESPHome that can be used to compile the firmware).
Here is the full changelog:
- Made it possible to use lambdas with the preset.activate automation. This makes it possible to link the action to an api service, which exposes the preset functionality to Home Assistant. The example.yaml has been updated with an example for this.
- Fixed a rounding error in the slider sensor component. When using custom "range from" / "range to" settings, the maximum value could exceed the "range to" value due to rounding errors. Thanks to Jos for the heads up!
- Made the codebase compatible with ESPHome v1.19.0 (PR #1657: Introduce new async-def coroutine syntax) Thanks to @Kaibob2 for giving me a heads up that my code was not compiling anymore!
The first stable release sees the light
Recently, ESPHome v1.18.0 was released.
It contains a few features that I was waiting for before declaring the Xiaomi Bedside Lamp 2
code stable. So now the time has come to publish the stable v1.0.0 release.
See the CHANGELOG.md in the repo for a full list of changes.
Migration info for existing users
If you have been using the patched version of AsyncTCP-esphome to get rid of disconnect issues, combined with lib_extra_dirs
in your platformio_options
, then you can delete the patched version and remove the lib_extra_dirs
from your YAML config. The required changes for AsyncTCP-esphome are now included automatically by ESPHome.
If you have been using the component code by downloading it to custom_components/xiaomi_bslamp2
up to now, then you can delete that directory, and instead add the following to your YAML config:
# Retrieve the code for the xiaomi_bslamp2 platform from GitHub.
external_components:
- source:
type: git
url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
ref: main
If you want to keep using a cloned repo instead (e.g. for developing on the code), then you can for example create a directory <CONFIG_DIR>/src
and clone the repository there. Then you can add the following to your YAML to point the build at it:
external_components:
- source:
type: local
path: src/xiaomi_bslamp2/components
Really close to a final stable release
After extensive testing, I think that it is about time to bring out a release candidate.
There have been various code improvements since the last release, but the main change is the reorganization of the project documentation. A whole new section "Configuration guide" has been added, in which you can find information about all the configuration options.
Another cool new feature is the addition of preset support. Using this new feature, it is possible to define groups of presets for the lamp, and let the lamp switch between them using the color button. This mimics the original behavior of the lamp when using the original firmware. How to configure this setup is fully covered in the doc/example.yaml
file.
The main reason for not making this a 1.0.0 stable release right now, is that I would love to make use of a wonderful new feature in ESPHome that is being worked on at this moment: the possibility to point ESPHome at my GitHub repo from the YAML configuration, to have it included automatically in a build. This takes away the need to download the code and move it into a custom_components
directory manually. This vastly improves the process for people who want to make use of the xiaomi_bslamp2 component implementation.
As soon as ESPHome includes this feature in the stable release, I will update my repository structure for supporting this and bring out 1.0.0 stable. Progress on this can be followed in this issue on the repo.
I hope you will enjoy this release.
I know I do! 😄
Beta time! Also: "yeelight_bs2" is dead, long live "xiaomi_bslamp2"!
The code is well on its way to becoming a stable release.
But first, here's the beta release!
This release contains various small bugfixes, a few feature improvements and some work was done to improve documentation and the example.yaml file.
The big change for this release, is that the custom component was renamed from "yeelight_bs2" to "xiaomi_bslamp2".
The reasoning behind this can be found in this issue: #7
When you are already using a previous version of the firmware, then note that the following changes are necessary:
- Update to the latest version of the custom component code. If you are using a clone of the GitHub repo, then
git pull
is all that you need. The old repo URLs will still work. - Rename your folder
<config path>/custom_components/yeelight_bs2
to<config path>/custom_components/xiaomi_bslamp2
- Update your yaml config by changing all occurrences of
yeelight_bs2
intoxiaomi_bslamp2
(or create a new configuration based on the latest example.yaml).
Hello, world!
As of today, the yeelight_bs2 platform supports the following components:
- light: controls the LEDs
- binary_sensor: touch/release sensors for power button, color button and slider
- sensor: sensor to report the level at which the slider was touched
- outpout: controls the front panel light and its level indicator
Since these are all the components that are required to make the lamp work, I declare this integration to have reached alpha state.
With alpha, I mainly want to stress that interface changes might still occur. Now the time has come to play with this fresh integration and outcomes of this might drive some backward-incompatible changes.
I hope you will enjoy this code!