ESPHome 2025.5.0
Loading...
Searching...
No Matches
light_effect.h
Go to the documentation of this file.
1#pragma once
2
3#include <utility>
4
6
7namespace esphome {
8namespace light {
9
10class LightState;
11
13 public:
14 explicit LightEffect(std::string name) : name_(std::move(name)) {}
15
17 virtual void start() {}
18
19 virtual void start_internal() { this->start(); }
20
22 virtual void stop() {}
23
25 virtual void apply() = 0;
26
27 const std::string &get_name() { return this->name_; }
28
30 virtual void init() {}
31
33 this->state_ = state;
34 this->init();
35 }
36
37 protected:
38 LightState *state_{nullptr};
39 std::string name_;
40};
41
42} // namespace light
43} // namespace esphome
virtual void init()
Internal method called by the LightState when this light effect is registered in it.
virtual void start()
Initialize this LightEffect. Will be called once after creation.
virtual void apply()=0
Apply this effect. Use the provided state for starting transitions, ...
virtual void stop()
Called when this effect is about to be removed.
const std::string & get_name()
LightEffect(std::string name)
virtual void start_internal()
void init_internal(LightState *state)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:63
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7