10static const char *
const TAG =
"ds1307";
13 ESP_LOGCONFIG(TAG,
"Setting up DS1307...");
22 ESP_LOGCONFIG(TAG,
"DS1307:");
25 ESP_LOGE(TAG,
"Communication with DS1307 failed!");
27 ESP_LOGCONFIG(TAG,
" Timezone: '%s'", this->
timezone_.c_str());
37 ESP_LOGW(TAG,
"RTC halted, not syncing to system clock.");
53 if (!rtc_time.is_valid()) {
54 ESP_LOGE(TAG,
"Invalid RTC time, not syncing to system clock.");
63 ESP_LOGE(TAG,
"Invalid system time, not syncing to RTC.");
86 ESP_LOGE(TAG,
"Can't read I2C data.");
89 ESP_LOGD(TAG,
"Read %0u%0u:%0u%0u:%0u%0u 20%0u%0u-%0u%0u-%0u%0u CH:%s RS:%0u SQWE:%s OUT:%s",
ds1307_.
reg.
hour_10,
99 ESP_LOGE(TAG,
"Can't write I2C data.");
102 ESP_LOGD(TAG,
"Write %0u%0u:%0u%0u:%0u%0u 20%0u%0u-%0u%0u-%0u%0u CH:%s RS:%0u SQWE:%s OUT:%s",
ds1307_.
reg.
hour_10,
virtual void mark_failed()
Mark this component as failed.
float get_setup_priority() const override
union esphome::ds1307::DS1307Component::DS1307Reg ds1307_
void dump_config() override
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
Compat APIs All methods below have been added for compatibility reasons.
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.
const float DATA
For components that import data from directly connected sensors like DHT.
Providing packet encoding functions for exchanging data with a remote host.
A more user-friendly version of struct tm from time.h.
uint8_t minute
minutes after the hour [0-59]
void recalc_timestamp_utc(bool use_day_of_year=true)
Recalculate the timestamp field from the other fields of this ESPTime instance (must be UTC).
uint8_t second
seconds after the minute [0-60]
uint8_t hour
hours since midnight [0-23]
bool is_valid() const
Check if this ESPTime is valid (all fields in range and year is greater than 2018)
uint8_t day_of_month
day of the month [1-31]
uint8_t month
month; january=1 [1-12]
uint8_t day_of_week
day of the week; sunday=1 [1-7]
struct esphome::ds1307::DS1307Component::DS1307Reg::@75 reg