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.

30 lines
1008 B

  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. public:
  15. XiaomiBslamp2LightState(const std::string &name, XiaomiBslamp2LightOutput *output) : light::LightState(name, output) {
  16. output->set_transformer_inspector(this);
  17. }
  18. bool is_active() { return transformer_ != nullptr; }
  19. bool is_transition() { return transformer_->is_transition(); }
  20. light::LightColorValues get_end_values() { return transformer_->get_end_values(); }
  21. float get_progress() { return transformer_->get_progress(); }
  22. };
  23. } // namespace bslamp2
  24. } // namespace xiaomi
  25. } // namespace esphome