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.

31 lines
1.0 KiB

  1. #pragma once
  2. #include "../common.h"
  3. namespace esphome {
  4. namespace xiaomi {
  5. namespace bslamp2 {
  6. /**
  7. * This custom LightState class is used to provide access to the protected
  8. * LightTranformer information in the LightState class.
  9. *
  10. * This class is used by the ColorTransitionHandler class to inspect if
  11. * an ongoing light color transition is active in the LightState object.
  12. */
  13. class XiaomiBslamp2LightState : public light::LightState, public LightStateTransformerInspector
  14. {
  15. public:
  16. XiaomiBslamp2LightState(const std::string &name, XiaomiBslamp2LightOutput *output) : light::LightState(name, output) {
  17. output->set_transformer_inspector(this);
  18. }
  19. bool is_active() { return transformer_ != nullptr; }
  20. bool is_transition() { return transformer_->is_transition(); }
  21. light::LightColorValues get_end_values() { return transformer_->get_end_values(); }
  22. float get_progress() { return transformer_->get_progress(); }
  23. };
  24. } // namespace bslamp2
  25. } // namespace xiaomi
  26. } // namespace esphome