8static const uint8_t RX8130_REG_SEC = 0x10;
9static const uint8_t RX8130_REG_MIN = 0x11;
10static const uint8_t RX8130_REG_HOUR = 0x12;
11static const uint8_t RX8130_REG_WDAY = 0x13;
12static const uint8_t RX8130_REG_MDAY = 0x14;
13static const uint8_t RX8130_REG_MONTH = 0x15;
14static const uint8_t RX8130_REG_YEAR = 0x16;
15static const uint8_t RX8130_REG_EXTEN = 0x1C;
16static const uint8_t RX8130_REG_FLAG = 0x1D;
17static const uint8_t RX8130_REG_CTRL0 = 0x1E;
18static const uint8_t RX8130_REG_CTRL1 = 0x1F;
19static const uint8_t RX8130_REG_DIG_OFFSET = 0x30;
20static const uint8_t RX8130_BIT_CTRL_STOP = 0x40;
21static const uint8_t RX8130_BAT_FLAGS = 0x30;
22static const uint8_t RX8130_CLEAR_FLAGS = 0x00;
59 ESP_LOGCONFIG(TAG,
"RX8130:");
61 RealTimeClock::dump_config();
70 ESPTime rtc_time = time::decode_bcd_calendar<time::EPSON_BCD_CALENDAR>(date);
71 if (!rtc_time.
is_valid(
true,
false)) {
72 ESP_LOGE(TAG,
"Invalid RTC time, not syncing to system clock.");
75 ESP_LOGD(TAG,
"Read UTC time: %04d-%02d-%02d %02d:%02d:%02d", rtc_time.
year, rtc_time.
month, rtc_time.
day_of_month,
83 ESP_LOGE(TAG,
"Invalid system time, not syncing to RTC.");
87 time::encode_bcd_calendar<time::EPSON_BCD_CALENDAR>(
now, buff);
99 const uint8_t data = stop ? RX8130_BIT_CTRL_STOP : RX8130_CLEAR_FLAGS;
void mark_failed()
Mark this component as failed.
void status_set_warning()
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len) const
writes an array of bytes to a specific register in the I²C device
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len)
reads an array of bytes from a specific register in the I²C device
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 synchronize_epoch_(uint32_t epoch)
Report a unix epoch as current time.
@ ERROR_OK
No error found during execution of method.
ESPHOME_LOG_TAG(TAG, "rx8130")
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]