ESPHome  2024.11.3
mqtt_light.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 
5 #ifdef USE_MQTT
6 #ifdef USE_LIGHT
7 
8 #include "mqtt_component.h"
10 
11 namespace esphome {
12 namespace mqtt {
13 
15  public:
17 
19 
20  void setup() override;
21 
22  void dump_config() override;
23 
24  void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
25 
26  bool send_initial_state() override;
27 
28  protected:
29  std::string component_type() const override;
30  const EntityBase *get_entity() const override;
31 
32  bool publish_state_();
33 
35 };
36 
37 } // namespace mqtt
38 } // namespace esphome
39 
40 #endif
41 #endif // USE_MQTT
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:63
light::LightState * get_state() const
Definition: mqtt_light.cpp:38
MQTTJSONLightComponent(light::LightState *state)
Definition: mqtt_light.cpp:32
Simple Helper struct used for Home Assistant MQTT send_discovery().
const EntityBase * get_entity() const override
Definition: mqtt_light.cpp:19
std::string component_type() const override
Definition: mqtt_light.cpp:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_light.cpp:40
bool state
Definition: fan.h:34
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...