Browse Source

Implemented compatibility with color mode support in the latest Home Assistant + ESPHome. (#44)

Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
pull/46/head v1.2.0-RC1
Maurice Makaay 3 years ago
committed by GitHub
parent
commit
3868b86b05
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions
  1. +7
    -0
      CHANGELOG.md
  2. +1
    -1
      README.md
  3. +1
    -1
      components/xiaomi_bslamp2/light/color_rgb_light.h
  4. +1
    -1
      components/xiaomi_bslamp2/light/color_white_light.h
  5. +1
    -5
      components/xiaomi_bslamp2/light/light_output.h

+ 7
- 0
CHANGELOG.md View File

@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.2.0-RC1]
**Note**: This release requires ESPHome v1.21.0 and Home Assistant 2021.8.0 or newer.
### Changed
- The code has been made compatible with the new color mode support in Home Assistant.
## [1.1.0] ## [1.1.0]
**Note**: This release requires ESPHome v1.20.0 or newer. **Note**: This release requires ESPHome v1.20.0 or newer.


+ 1
- 1
README.md View File

@ -49,7 +49,7 @@ aspect of the lamp and to integrate the lamp in your Home Assistant setup.
For those who have experience with flashing ESPHome onto devices: For those who have experience with flashing ESPHome onto devices:
* Make sure you are using ESPHome v1.20.0 or newer.
* Make sure you are using ESPHome v1.21.0 or newer.
* Copy [`example.yaml`](example.yaml) to `<CONFIG_DIR>/<NODE_NAME>.yaml`. * Copy [`example.yaml`](example.yaml) to `<CONFIG_DIR>/<NODE_NAME>.yaml`.
* Modify the configuration to your needs (see the [configuration guide](doc/configuration.md)). * Modify the configuration to your needs (see the [configuration guide](doc/configuration.md)).
* Compile the `firmware.bin` file and download it to the device to which you have connected your * Compile the `firmware.bin` file and download it to the device to which you have connected your


+ 1
- 1
components/xiaomi_bslamp2/light/color_rgb_light.h View File

@ -252,7 +252,7 @@ class ColorRGBLight : public GPIOOutputs {
bool set_light_color_values(light::LightColorValues v) { bool set_light_color_values(light::LightColorValues v) {
light_mode = LIGHT_MODE_RGB; light_mode = LIGHT_MODE_RGB;
if (v.get_white() > 0.0f) {
if (v.get_color_mode() != light::ColorMode::RGB) {
return false; return false;
} }


+ 1
- 1
components/xiaomi_bslamp2/light/color_white_light.h View File

@ -80,7 +80,7 @@ class ColorWhiteLight : public GPIOOutputs {
bool set_light_color_values(light::LightColorValues v) { bool set_light_color_values(light::LightColorValues v) {
light_mode = LIGHT_MODE_WHITE; light_mode = LIGHT_MODE_WHITE;
if (v.get_white() == 0.0f) {
if (v.get_color_mode() != light::ColorMode::COLOR_TEMPERATURE) {
return false; return false;
} }


+ 1
- 5
components/xiaomi_bslamp2/light/light_output.h View File

@ -28,11 +28,7 @@ class XiaomiBslamp2LightOutput : public Component, public light::LightOutput {
*/ */
light::LightTraits get_traits() override { light::LightTraits get_traits() override {
auto traits = light::LightTraits(); auto traits = light::LightTraits();
traits.set_supports_rgb(true);
traits.set_supports_color_temperature(true);
traits.set_supports_brightness(true);
traits.set_supports_rgb_white_value(false);
traits.set_supports_color_interlock(true);
traits.set_supported_color_modes({light::ColorMode::RGB, light::ColorMode::COLOR_TEMPERATURE});
traits.set_min_mireds(MIRED_MIN); traits.set_min_mireds(MIRED_MIN);
traits.set_max_mireds(MIRED_MAX); traits.set_max_mireds(MIRED_MAX);
return traits; return traits;


Loading…
Cancel
Save