ESPHome 2026.1.5
Loading...
Searching...
No Matches
mqtt_event.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_EVENT
7
9#include "mqtt_component.h"
10
11namespace esphome::mqtt {
12
14 public:
15 explicit MQTTEventComponent(event::Event *event);
16
17 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
18
19 void setup() override;
20
21 void dump_config() override;
22
24 bool send_initial_state() override { return true; }
25
26 protected:
27 bool publish_event_(const std::string &event_type);
28 const char *component_type() const override;
29 const EntityBase *get_entity() const override;
30
32};
33
34} // namespace esphome::mqtt
35
36#endif
37#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
const char * component_type() const override
bool publish_event_(const std::string &event_type)
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
bool send_initial_state() override
Events do not send a state so just return true.
Definition mqtt_event.h:24
const EntityBase * get_entity() const override
MQTTEventComponent(event::Event *event)
Simple Helper struct used for Home Assistant MQTT send_discovery().