20 void setup()
override;
36 std::array<uint8_t, 3>
rgb{};
47 template<
typename T>
void import_(T &field,
const T &value) {
StringRef is a reference to a string owned by something else.
A light in Home Assistant, driven from here: its state and attributes are imported over the native AP...
void dump_config() override
void fall_back_()
Returns the light to the reported state after a change that did not reach Home Assistant.
optional< uint16_t > parse_integer_(const char *name, StringRef value, uint16_t max)
Parses a Home Assistant attribute as an integer from 1 to max, logging anything else.
void on_report_(bool changed)
A state or attribute report: answers a pending echo when it changed something, and schedules the appl...
void schedule_apply_()
Schedules apply_imported_() once for the attributes of one update.
light::LightTraits get_traits() override
void write_state(light::LightState *state) override
void update_state(light::LightState *state) override
light::LightState * state_
void import_(T &field, const T &value)
Takes over a reported attribute, reporting whether it changed.
void setup_state(light::LightState *state) override
void set_entity_id(const char *entity_id)
bool is_imported_(const Attributes &outgoing) const
True when Home Assistant reported exactly what a change would make of it.
void set_report_timeout(uint8_t seconds)
How long a sent change may take to come back as a report before the light returns to the reported sta...
light::LightTraits traits_
float get_setup_priority() const override
uint8_t report_timeout_s_
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
This class is used to represent the capabilities of a light.
ColorMode
Color modes are a combination of color capabilities that can be used at the same time.
@ UNKNOWN
No color mode configured (cannot be a supported mode, only active when light is off).
constexpr float AFTER_CONNECTION
For components that should be initialized after a data connection (API/MQTT) is connected.
What Home Assistant reported last, in its own units.
light::ColorMode color_mode
std::array< uint8_t, 3 > rgb
uint16_t color_temp_kelvin