ESPHome  2024.11.0
status_led_light.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
7 
8 namespace esphome {
9 namespace 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
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:63
Interface to write LightStates to hardware.
Definition: light_output.h:12
void set_output(output::BinaryOutput *output)
void setup_state(light::LightState *state) override
void write_state(light::LightState *state) override
Light can be turned on/off.
light::LightTraits get_traits() override
This class is used to represent the capabilities of a light.
Definition: light_traits.h:11
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool state
Definition: fan.h:34