ESPHome 2026.8.0-dev
Loading...
Searching...
No Matches
interval.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/log.h"
6
8
9class IntervalTrigger final : public Trigger<>, public PollingComponent {
10 public:
11 void update() override { this->trigger(); }
12
13 void setup() override {
14 if (this->startup_delay_ != 0) {
15 this->stop_poller();
16 this->set_timeout(this->startup_delay_, [this] { this->start_poller(); });
17 }
18 }
19
20 void set_startup_delay(const uint32_t startup_delay) { this->startup_delay_ = startup_delay; }
21
22 protected:
24};
25
26} // namespace esphome::interval
void set_timeout(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a const char* name.
Definition component.cpp:96
This class simplifies creating components that periodically check a state.
Definition component.h:510
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Definition automation.h:461
void set_startup_delay(const uint32_t startup_delay)
Definition interval.h:20
static void uint32_t