ESPHome 2026.5.3
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 : 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
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Definition component.h:510
This class simplifies creating components that periodically check a state.
Definition component.h:602
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Definition automation.h:482
void set_startup_delay(const uint32_t startup_delay)
Definition interval.h:20
static void uint32_t