mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-02 02:58:26 +02:00
time sync notification (#1442)
* add on_time_sync trigger * cleanup lint * fix review remark (sntp didn't trigger callbacks)
This commit is contained in:
@@ -127,11 +127,17 @@ class RealTimeClock : public PollingComponent {
|
||||
|
||||
void call_setup() override;
|
||||
|
||||
void add_on_time_sync_callback(std::function<void()> callback) {
|
||||
this->time_sync_callback_.add(std::move(callback));
|
||||
};
|
||||
|
||||
protected:
|
||||
/// Report a unix epoch as current time.
|
||||
void synchronize_epoch_(uint32_t epoch);
|
||||
|
||||
std::string timezone_{};
|
||||
|
||||
CallbackManager<void()> time_sync_callback_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class TimeHasTimeCondition : public Condition<Ts...> {
|
||||
|
||||
Reference in New Issue
Block a user