12static const char *
const TAG =
"mqtt.event";
22 event_types.add(event_type);
26 if (!device_class.empty()) {
40 ESP_LOGCONFIG(TAG,
"Event Types: ");
42 ESP_LOGCONFIG(TAG,
"- %s", event_type);
44 LOG_MQTT_COMPONENT(
true,
true);
StringRef get_device_class_ref() const
Get the device class as StringRef.
const StringRef & get_name() const
constexpr const char * c_str() const
const FixedVector< const char * > & get_event_types() const
Return the event types supported by this event.
void add_on_event_callback(std::function< void(const std::string &event_type)> &&callback)
bool publish_json(const std::string &topic, const json::json_build_t &f)
Construct and send a JSON MQTT message.
std::string get_state_topic_() const
Get the MQTT topic that new states will be shared to.
std::string component_type() const override
bool publish_event_(const std::string &event_type)
void dump_config() override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
const EntityBase * get_entity() const override
MQTTEventComponent(event::Event *event)
constexpr const char *const MQTT_EVENT_TYPES
constexpr const char *const MQTT_DEVICE_CLASS
constexpr const char *const MQTT_EVENT_TYPE
Providing packet encoding functions for exchanging data with a remote host.
Simple Helper struct used for Home Assistant MQTT send_discovery().
bool command_topic
If the command topic should be included. Default to true.