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.

28 lines
707 B

  1. #pragma once
  2. #include "../common.h"
  3. #include "../front_panel_hal.h"
  4. #include "esphome/components/output/float_output.h"
  5. #include <cmath>
  6. namespace esphome {
  7. namespace xiaomi {
  8. namespace bslamp2 {
  9. /**
  10. * An output, used for controlling the front panel illumination and
  11. * 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) { front_panel_->set_light_level(level); }
  17. protected:
  18. FrontPanelHAL *front_panel_;
  19. };
  20. } // namespace bslamp2
  21. } // namespace xiaomi
  22. } // namespace esphome