9static constexpr uint8_t RX8025T_REG_SEC = 0x00;
10static constexpr uint8_t RX8025T_REG_FLAG = 0x0E;
11static constexpr uint8_t RX8025T_FLAG_VDET = 0x01;
12static constexpr uint8_t RX8025T_FLAG_VLF = 0x02;
23 if (
flags & RX8025T_FLAG_VLF) {
24 ESP_LOGW(TAG,
"VLF flag is set - Loss of oscillator detected. Time may be invalid.");
31 ESP_LOGCONFIG(TAG,
"RX8025T:");
38 ESP_LOGE(TAG,
"Can't read flag register.");
53 ESP_LOGE(TAG,
"Can't read I2C data.");
57 if (
flags & RX8025T_FLAG_VLF) {
58 ESP_LOGW(TAG,
"VLF flag is set - time data may be invalid, not syncing to system clock.");
62 ESPTime rtc_time = time::decode_bcd_calendar<time::EPSON_BCD_CALENDAR>(date);
63 if (!rtc_time.
is_valid(
true,
false)) {
64 ESP_LOGE(TAG,
"Invalid RTC time, not syncing to system clock.");
67 ESP_LOGD(TAG,
"Read UTC time: %04d-%02d-%02d %02d:%02d:%02d VDET:%s", rtc_time.
year, rtc_time.
month,
75 ESP_LOGE(TAG,
"Invalid system time, not syncing to RTC.");
80 time::encode_bcd_calendar<time::EPSON_BCD_CALENDAR>(
now, buff);
81 if (!this->
write_bytes(RX8025T_REG_SEC, buff,
sizeof(buff))) {
82 ESP_LOGE(TAG,
"Can't write I2C data.");
94 flags &= ~(RX8025T_FLAG_VLF | RX8025T_FLAG_VDET);
void mark_failed()
Mark this component as failed.
void status_set_warning()
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
bool write_byte(uint8_t a_register, uint8_t data) const
bool read_byte(uint8_t a_register, uint8_t *data)
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len) const
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
Compat APIs All methods below have been added for compatibility reasons.
bool read_flags_(uint8_t *flags)
void dump_config() override
ESPTime now()
Get the time in the currently defined timezone.
ESPTime utcnow()
Get the time without any time zone or DST corrections.
void dump_config() override
void synchronize_epoch_(uint32_t epoch)
Report a unix epoch as current time.
ESPHOME_LOG_TAG(TAG, "rx8025t")
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]
time_t timestamp
unix epoch time (seconds since UTC Midnight January 1, 1970)
bool is_valid(bool check_day_of_week=true, bool check_day_of_year=true) const
Check if this ESPTime is valid (year >= 2019 and the requested fields are in range).
uint8_t day_of_month
day of the month [1-31]
uint8_t month
month; january=1 [1-12]