3#ifdef USE_DATETIME_DATE
9static const char *
const TAG =
"template.date";
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_year =
call.get_year();
52 auto opt_month =
call.get_month();
53 auto opt_day =
call.get_day();
54 bool has_year = opt_year.has_value();
55 bool has_month = opt_month.has_value();
56 bool has_day = opt_day.has_value();
60 value.
year = *opt_year;
63 value.
month = *opt_month;
72 this->
year_ = *opt_year;
76 this->
day_ = *opt_day;
83 temp.
year = *opt_year;
88 temp.
month = *opt_month;
103 LOG_DATETIME_DATE(
"",
"Template Date",
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)
Inform the parent automation that the event has triggered.
void dump_config() override
ESPPreferenceObject pref_
TemplateLambda< ESPTime > f_
void control(const datetime::DateCall &call) override
Trigger< ESPTime > set_trigger_
A more user-friendly version of struct tm from time.h.
uint8_t day_of_month
day of the month [1-31]
uint8_t month
month; january=1 [1-12]
void apply(DateEntity *date)