1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

make time components polling components (#1443)

* make real time clock components polling components

* add test
This commit is contained in:
Florian Mösch
2021-01-12 19:37:22 +01:00
committed by GitHub
parent fbc1b3e316
commit bf453ad8cd
12 changed files with 20 additions and 21 deletions

View File

@@ -14,9 +14,10 @@ void DS1307Component::setup() {
if (!this->read_rtc_()) {
this->mark_failed();
}
this->set_interval(15 * 60 * 1000, [&]() { this->read(); });
}
void DS1307Component::update() { this->read(); }
void DS1307Component::dump_config() {
ESP_LOGCONFIG(TAG, "DS1307:");
LOG_I2C_DEVICE(this);

View File

@@ -10,6 +10,7 @@ namespace ds1307 {
class DS1307Component : public time::RealTimeClock, public i2c::I2CDevice {
public:
void setup() override;
void update() override;
void dump_config() override;
float get_setup_priority() const override;
void read();