ESPHome 2026.11.0b6
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
16 public:
17 explicit DelayedIntervalTrigger(uint32_t startup_delay) : startup_delay_(startup_delay) {}
18
19 void setup() override {
20 this->stop_poller();
21 this->set_timeout(this->startup_delay_, [this] { this->start_poller(); });
22 }
23
24 protected:
26};
27
28} // 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:532
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Definition automation.h:557
An interval whose first run waits for a startup delay; only used when the delay is not zero.
Definition interval.h:15
DelayedIntervalTrigger(uint32_t startup_delay)
Definition interval.h:17
static void uint32_t