ESPHome 2026.5.0
Loading...
Searching...
No Matches
status_led_light.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
7
8namespace esphome::status_led {
9
11 public:
12 void set_pin(GPIOPin *pin) { pin_ = pin; }
13 void set_output(output::BinaryOutput *output) { output_ = output; }
14
16 auto traits = light::LightTraits();
17 traits.set_supported_color_modes({light::ColorMode::ON_OFF});
18 return traits;
19 }
20
21 void loop() override;
22
23 void setup_state(light::LightState *state) override;
24
25 void write_state(light::LightState *state) override;
26
27 void setup() override;
28
29 void dump_config() override;
30
31 float get_setup_priority() const override { return setup_priority::HARDWARE; }
32
33 protected:
34 GPIOPin *pin_{nullptr};
37 uint8_t last_app_state_{0xFF};
38 void output_state_(bool state);
39};
40
41} // namespace esphome::status_led
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:93
This class is used to represent the capabilities of a light.
Definition light_traits.h:9
light::LightTraits get_traits() override
void set_output(output::BinaryOutput *output)
void write_state(light::LightState *state) override
void setup_state(light::LightState *state) override
bool state
Definition fan.h:2
@ ON_OFF
Only on/off control.
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:41