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

  1. #pragma once
  2. #include <cmath>
  3. #include "../common.h"
  4. #include "../front_panel_hal.h"
  5. #include "esphome/components/output/float_output.h"
  6. namespace esphome {
  7. namespace xiaomi {
  8. namespace bslamp2 {
  9. /**
  10. * An output, used for controlling the front panel illumination and
  11. * brightness level indicator on the Xiaomi Mijia Bedside Lamp 2 front panel.
  12. */
  13. class XiaomiBslamp2FrontPanelLight : public output::FloatOutput, public Component {
  14. public:
  15. void set_parent(FrontPanelHAL *front_panel) { front_panel_ = front_panel; }
  16. void write_state(float level) {
  17. front_panel_->set_light_level(level);
  18. }
  19. protected:
  20. FrontPanelHAL *front_panel_;
  21. };
  22. } // namespace bslamp2
  23. } // namespace yxiaomi
  24. } // namespace esphome