10 static 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.");
48 rtc_time.recalc_timestamp_utc(
false);
49 if (!rtc_time.is_valid()) {
50 ESP_LOGE(TAG,
"Invalid RTC time, not syncing to system clock.");
59 ESP_LOGE(TAG,
"Invalid system time, not syncing to RTC.");
82 ESP_LOGE(TAG,
"Can't read I2C data.");
85 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,
95 ESP_LOGE(TAG,
"Can't write I2C data.");
98 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,
uint8_t month
month; january=1 [1-12]
ESPTime now()
Get the time in the currently defined timezone.
const float DATA
For components that import data from directly connected sensors like DHT.
bool is_valid() const
Check if this ESPTime is valid (all fields in range and year is greater than 2018) ...
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
uint8_t minute
minutes after the hour [0-59]
void dump_config() override
A more user-friendly version of struct tm from time.h.
uint8_t second
seconds after the minute [0-60]
union esphome::ds1307::DS1307Component::DS1307Reg ds1307_
float get_setup_priority() const override
ESPTime utcnow()
Get the time without any time zone or DST corrections.
uint8_t day_of_week
day of the week; sunday=1 [1-7]
virtual void mark_failed()
Mark this component as failed.
struct esphome::ds1307::DS1307Component::DS1307Reg::@59 reg
void synchronize_epoch_(uint32_t epoch)
Report a unix epoch as current time.
uint8_t day_of_month
day of the month [1-31]
uint8_t hour
hours since midnight [0-23]
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)