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
646 B

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