ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
syncer.h
Go to the documentation of this file.
1#pragma once
2
5// Include for ESPDEPRECATED, Remove before 2027.3.0
7
9
10class IntervalSyncer final : public PollingComponent {
11 public:
12 // Remove before 2027.3.0
13 ESPDEPRECATED("Use set_update_interval() instead. Removed in 2027.3.0", "2026.9.0")
14 void set_write_interval(uint32_t write_interval) { this->set_update_interval(write_interval); }
15 void update() override { global_preferences->sync(); }
16 void on_shutdown() override { global_preferences->sync(); }
17 float get_setup_priority() const override { return setup_priority::BUS; }
18};
19
20} // namespace esphome::preferences
This class simplifies creating components that periodically check a state.
Definition component.h:510
void set_update_interval(uint32_t update_interval)
Manually set the update interval in ms for this polling object.
Definition component.h:524
ESPDEPRECATED("Use set_update_interval() instead. Removed in 2027.3.0", "2026.9.0") void set_write_interval(uint32_t write_interval)
Definition syncer.h:13
float get_setup_priority() const override
Definition syncer.h:17
constexpr float BUS
For communication buses like i2c/spi.
Definition component.h:39
ESPPreferences * global_preferences
static void uint32_t
bool sync()
Commit pending writes to flash.
Definition preferences.h:33