12 const char *found =
nullptr;
14 if (strcmp(
type, event_type) == 0) {
19 if (found ==
nullptr) {
20 ESP_LOGE(TAG,
"'%s': invalid event type for trigger(): %s", LOG_STR_ARG(this->
get_log_name()), event_type);
23 this->last_event_type_ = found;
24 ESP_LOGV(TAG,
"'%s' >> '%s'", LOG_STR_ARG(this->
get_log_name()), this->last_event_type_);
26#if defined(USE_EVENT) && defined(USE_CONTROLLER_REGISTRY)
27 ControllerRegistry::notify_event(
this);
33 this->last_event_type_ =
nullptr;
const LogString * get_log_name() const
Get the name for a "%s" log argument (LOG_STR_ARG).
StringRef is a reference to a string owned by something else.
LazyCallbackManager< void(StringRef event_type)> event_callback_
void trigger(const char *event_type)
Trigger an event; the type is matched against the configured types by string compare.
void set_event_types_copy_(const char *const *event_types, size_t count)
ESPHOME_LOG_TAG(TAG, "event")