1 #include "automation.h" 10 static const char *
const TAG =
"automation";
11 static const int MAX_TIMESTAMP_DRIFT = 900;
32 ESP_LOGW(TAG,
"Time has jumped back!");
36 }
else if (time > *this->
last_check_ && time.
timestamp - this->last_check_->timestamp > MAX_TIMESTAMP_DRIFT) {
38 ESP_LOGW(TAG,
"Time has jumped ahead!");
55 ESP_LOGW(TAG,
"Time is out of range!");
56 ESP_LOGD(TAG,
"Second=%02u Minute=%02u Hour=%02u DayOfWeek=%u DayOfMonth=%u DayOfYear=%u Month=%u time=%" PRId64,
66 for (uint8_t it : seconds)
70 for (uint8_t it : minutes)
74 for (uint8_t it : hours)
78 for (uint8_t it : days_of_month)
82 for (uint8_t it : months)
86 for (uint8_t it : days_of_week)
void add_days_of_week(const std::vector< uint8_t > &days_of_week)
void add_hour(uint8_t hour)
ESPTime now()
Get the time in the currently defined timezone.
bool matches(const ESPTime &time)
SyncTrigger(RealTimeClock *rtc)
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock...
A more user-friendly version of struct tm from time.h.
void add_minutes(const std::vector< uint8_t > &minutes)
std::bitset< 61 > seconds_
float get_setup_priority() const override
void add_on_time_sync_callback(std::function< void()> callback)
void add_seconds(const std::vector< uint8_t > &seconds)
uint16_t day_of_year
day of the year [1-366]
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
CronTrigger(RealTimeClock *rtc)
std::bitset< 13 > months_
uint8_t second
seconds after the minute [0-60]
time_t timestamp
unix epoch time (seconds since UTC Midnight January 1, 1970)
void add_month(uint8_t month)
std::bitset< 60 > minutes_
void add_day_of_month(uint8_t day_of_month)
uint8_t minute
minutes after the hour [0-59]
void add_months(const std::vector< uint8_t > &months)
void add_days_of_month(const std::vector< uint8_t > &days_of_month)
bool is_valid() const
Check if this ESPTime is valid (all fields in range and year is greater than 2018) ...
std::bitset< 8 > days_of_week_
uint8_t day_of_week
day of the week; sunday=1 [1-7]
std::bitset< 32 > days_of_month_
optional< ESPTime > last_check_
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
void add_second(uint8_t second)
Implementation of SPI Controller mode.
void add_day_of_week(uint8_t day_of_week)
uint8_t month
month; january=1 [1-12]
uint8_t hour
hours since midnight [0-23]
void add_hours(const std::vector< uint8_t > &hours)
void add_minute(uint8_t minute)
uint8_t day_of_month
day of the month [1-31]
bool fields_in_range() const
Check if all time fields of this ESPTime are in range.