ESPHome 2025.5.0
Loading...
Searching...
No Matches
mqtt_light.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_LIGHT
7
8#include "mqtt_component.h"
10
11namespace esphome {
12namespace 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
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
MQTTJSONLightComponent(light::LightState *state)
const EntityBase * get_entity() const override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
light::LightState * get_state() const
std::string component_type() const override
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Simple Helper struct used for Home Assistant MQTT send_discovery().