ESPHome 2025.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 {
9namespace status_led {
10
12 public:
13 void set_pin(GPIOPin *pin) { pin_ = pin; }
14 void set_output(output::BinaryOutput *output) { output_ = output; }
15
17 auto traits = light::LightTraits();
18 traits.set_supported_color_modes({light::ColorMode::ON_OFF});
19 return traits;
20 }
21
22 void loop() override;
23
24 void setup_state(light::LightState *state) override;
25
26 void write_state(light::LightState *state) override;
27
28 void setup() override;
29
30 void dump_config() override;
31
32 float get_setup_priority() const override { return setup_priority::HARDWARE; }
33 float get_loop_priority() const override { return 50.0f; }
34
35 protected:
36 GPIOPin *pin_{nullptr};
39 uint32_t last_app_state_{0xFFFF};
40 void output_state_(bool state);
41};
42
43} // namespace status_led
44} // namespace esphome
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:63
This class is used to represent the capabilities of a light.
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:0
@ ON_OFF
Only on/off control.
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.cpp:18
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7