mirror of
https://github.com/esphome/esphome.git
synced 2025-09-29 00:22:21 +01:00
Addressable updates
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "light_effect.h"
|
||||
#include "esphome/core/automation.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
@@ -63,6 +64,21 @@ class LambdaLightEffect : public LightEffect {
|
||||
uint32_t last_run_{0};
|
||||
};
|
||||
|
||||
class AutomationLightEffect : public LightEffect {
|
||||
public:
|
||||
AutomationLightEffect(const std::string &name) : LightEffect(name) {}
|
||||
void stop() override { this->trig_->stop(); }
|
||||
void apply() override {
|
||||
if (!this->trig_->is_running()) {
|
||||
this->trig_->trigger();
|
||||
}
|
||||
}
|
||||
Trigger<> *get_trig() const { return trig_; }
|
||||
|
||||
protected:
|
||||
Trigger<> *trig_{new Trigger<>};
|
||||
};
|
||||
|
||||
struct StrobeLightEffectColor {
|
||||
LightColorValues color;
|
||||
uint32_t duration;
|
||||
|
Reference in New Issue
Block a user