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.

29 lines
629 B

  1. #pragma once
  2. #include "esphome/core/automation.h"
  3. #include "esphome/core/component.h"
  4. #include "output.h"
  5. #include <cmath>
  6. namespace esphome {
  7. namespace xiaomi {
  8. namespace bslamp2 {
  9. template<typename... Ts> class SetLEDsAction : public Action<Ts...> {
  10. public:
  11. explicit SetLEDsAction(XiaomiBslamp2FrontPanelOutput *parent) : parent_(parent) {}
  12. TEMPLATABLE_VALUE(uint16_t, leds)
  13. void play(Ts... x) override {
  14. uint16_t value = this->leds_.value(x...);
  15. parent_->set_leds(value);
  16. }
  17. protected:
  18. XiaomiBslamp2FrontPanelOutput *parent_;
  19. };
  20. } // namespace bslamp2
  21. } // namespace xiaomi
  22. } // namespace esphome