ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
template_date.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_DATETIME_DATE
6
11#include "esphome/core/time.h"
13
14namespace esphome {
15namespace template_ {
16
18 public:
19 template<typename F> void set_template(F &&f) { this->f_.set(std::forward<F>(f)); }
20
21 void setup() override;
22 void update() override;
23 void dump_config() override;
24 float get_setup_priority() const override { return setup_priority::HARDWARE; }
25
27 void set_optimistic(bool optimistic) { this->optimistic_ = optimistic; }
28
29 void set_initial_value(ESPTime initial_value) { this->initial_value_ = initial_value; }
30 void set_restore_value(bool restore_value) { this->restore_value_ = restore_value; }
31
32 protected:
33 void control(const datetime::DateCall &call) override;
34
35 bool optimistic_{false};
37 bool restore_value_{false};
40
42};
43
44} // namespace template_
45} // namespace esphome
46
47#endif // USE_DATETIME_DATE
This class simplifies creating components that periodically check a state.
Definition component.h:437
Lightweight wrapper for template platform lambdas (stateless function pointers only).
void set_restore_value(bool restore_value)
Trigger< ESPTime > * set_trigger_
float get_setup_priority() const override
void set_initial_value(ESPTime initial_value)
TemplateLambda< ESPTime > f_
void control(const datetime::DateCall &call) override
Trigger< ESPTime > * get_set_trigger() const
void set_optimistic(bool optimistic)
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.cpp:58
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
A more user-friendly version of struct tm from time.h.
Definition time.h:15