You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
681 B

  1. #pragma once
  2. #include <array>
  3. #include <stdexcept>
  4. #include "common.h"
  5. namespace esphome {
  6. namespace yeelight {
  7. namespace bs2 {
  8. class ColorOff : public GPIOOutputs {
  9. public:
  10. bool set_light_color_values(light::LightColorValues v) {
  11. // This class can handle the light settings when the light is turned
  12. // off or the brightness is set to zero.
  13. if (v.get_state() != 0.0f && v.get_brightness() != 0.0f) {
  14. return false;
  15. }
  16. values = v;
  17. red = 1.0f;
  18. green = 1.0f;
  19. blue = 1.0f;
  20. white = 0.0f;
  21. return true;
  22. }
  23. };
  24. } // namespace yeelight_bs2
  25. } // namespace yeelight
  26. } // namespace bs2