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:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user