ESPHome  2024.5.4
automation.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "esphome/core/time.h"
6 
7 #include "real_time_clock.h"
8 
9 #include <vector>
10 
11 namespace esphome {
12 namespace time {
13 
14 class CronTrigger : public Trigger<>, public Component {
15  public:
16  explicit CronTrigger(RealTimeClock *rtc);
17  void add_second(uint8_t second);
18  void add_seconds(const std::vector<uint8_t> &seconds);
19  void add_minute(uint8_t minute);
20  void add_minutes(const std::vector<uint8_t> &minutes);
21  void add_hour(uint8_t hour);
22  void add_hours(const std::vector<uint8_t> &hours);
23  void add_day_of_month(uint8_t day_of_month);
24  void add_days_of_month(const std::vector<uint8_t> &days_of_month);
25  void add_month(uint8_t month);
26  void add_months(const std::vector<uint8_t> &months);
27  void add_day_of_week(uint8_t day_of_week);
28  void add_days_of_week(const std::vector<uint8_t> &days_of_week);
29  bool matches(const ESPTime &time);
30  void loop() override;
31  float get_setup_priority() const override;
32 
33  protected:
34  std::bitset<61> seconds_;
35  std::bitset<60> minutes_;
36  std::bitset<24> hours_;
37  std::bitset<32> days_of_month_;
38  std::bitset<13> months_;
39  std::bitset<8> days_of_week_;
42 };
43 
44 class SyncTrigger : public Trigger<>, public Component {
45  public:
46  explicit SyncTrigger(RealTimeClock *rtc);
47 
48  protected:
50 };
51 } // namespace time
52 } // namespace esphome
void add_days_of_week(const std::vector< uint8_t > &days_of_week)
Definition: automation.cpp:85
void add_hour(uint8_t hour)
Definition: automation.cpp:16
bool matches(const ESPTime &time)
Definition: automation.cpp:20
The RealTimeClock class exposes common timekeeping functions via the device&#39;s local real-time clock...
A more user-friendly version of struct tm from time.h.
Definition: time.h:17
void add_minutes(const std::vector< uint8_t > &minutes)
Definition: automation.cpp:69
std::bitset< 61 > seconds_
Definition: automation.h:34
float get_setup_priority() const override
Definition: automation.cpp:89
void add_seconds(const std::vector< uint8_t > &seconds)
Definition: automation.cpp:65
uint8_t minute
CronTrigger(RealTimeClock *rtc)
Definition: automation.cpp:64
std::bitset< 13 > months_
Definition: automation.h:38
void add_month(uint8_t month)
Definition: automation.cpp:18
uint8_t hour
std::bitset< 60 > minutes_
Definition: automation.h:35
void add_day_of_month(uint8_t day_of_month)
Definition: automation.cpp:17
uint8_t second
RealTimeClock * rtc_
Definition: automation.h:40
void add_months(const std::vector< uint8_t > &months)
Definition: automation.cpp:81
void add_days_of_month(const std::vector< uint8_t > &days_of_month)
Definition: automation.cpp:77
std::bitset< 8 > days_of_week_
Definition: automation.h:39
std::bitset< 32 > days_of_month_
Definition: automation.h:37
optional< ESPTime > last_check_
Definition: automation.h:41
RealTimeClock * rtc_
Definition: automation.h:49
std::bitset< 24 > hours_
Definition: automation.h:36
void add_second(uint8_t second)
Definition: automation.cpp:14
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void add_day_of_week(uint8_t day_of_week)
Definition: automation.cpp:19
void add_hours(const std::vector< uint8_t > &hours)
Definition: automation.cpp:73
void add_minute(uint8_t minute)
Definition: automation.cpp:15
uint8_t month
Definition: date_entity.h:112