ESPHome 2025.5.0
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 {
12namespace mqtt {
13
15 public:
16 explicit MQTTEventComponent(event::Event *event);
17
18 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
19
20 void setup() override;
21
22 void dump_config() override;
23
25 bool send_initial_state() override { return true; }
26
27 protected:
28 bool publish_event_(const std::string &event_type);
29 std::string component_type() const override;
30 const EntityBase *get_entity() const override;
31
33};
34
35} // namespace mqtt
36} // namespace esphome
37
38#endif
39#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
std::string 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:25
const EntityBase * get_entity() const override
MQTTEventComponent(event::Event *event)
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().