3#ifdef USE_DATETIME_TIME
9static const char *
const TAG =
"template.time";
12 if (this->
f_.has_value())
38 if (!this->
f_.has_value())
41 auto val = this->
f_();
42 if (
val.has_value()) {
51 auto opt_hour =
call.get_hour();
52 auto opt_minute =
call.get_minute();
53 auto opt_second =
call.get_second();
54 bool has_hour = opt_hour.has_value();
55 bool has_minute = opt_minute.has_value();
56 bool has_second = opt_second.has_value();
60 value.
hour = *opt_hour;
63 value.
minute = *opt_minute;
66 value.
second = *opt_second;
72 this->
hour_ = *opt_hour;
83 temp.
hour = *opt_hour;
103 LOG_DATETIME_TIME(
"",
"Template Time",
this);
104 ESP_LOGCONFIG(TAG,
" Optimistic: %s", YESNO(this->
optimistic_));
105 LOG_UPDATE_INTERVAL(
this);
ESPPreferenceObject make_entity_preference(uint32_t version=0)
Create a preference object for storing this entity's state/settings.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Trigger< ESPTime > set_trigger_
TemplateLambda< ESPTime > f_
void control(const datetime::TimeCall &call) override
void dump_config() override
ESPPreferenceObject pref_
A more user-friendly version of struct tm from time.h.
uint8_t minute
minutes after the hour [0-59]
uint8_t second
seconds after the minute [0-60]
uint8_t hour
hours since midnight [0-23]
void apply(TimeEntity *time)