ESPHome
2026.5.3
Loading...
Searching...
No Matches
esphome
components
interval
interval.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/core/log.h
"
5
#include "
esphome/core/automation.h
"
6
7
namespace
esphome::interval
{
8
9
class
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
:
23
uint32_t
startup_delay_
{0};
24
};
25
26
}
// namespace esphome::interval
esphome::Component::set_timeout
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
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:602
esphome::PollingComponent::start_poller
void start_poller()
Definition
component.cpp:497
esphome::PollingComponent::stop_poller
void stop_poller()
Definition
component.cpp:502
esphome::Trigger
Definition
automation.h:477
esphome::Trigger<>::trigger
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Definition
automation.h:482
esphome::interval::IntervalTrigger
Definition
interval.h:9
esphome::interval::IntervalTrigger::set_startup_delay
void set_startup_delay(const uint32_t startup_delay)
Definition
interval.h:20
esphome::interval::IntervalTrigger::update
void update() override
Definition
interval.h:11
esphome::interval::IntervalTrigger::setup
void setup() override
Definition
interval.h:13
esphome::interval::IntervalTrigger::startup_delay_
uint32_t startup_delay_
Definition
interval.h:23
component.h
automation.h
log.h
esphome::interval
Definition
interval.h:7
uint32_t
static void uint32_t
Definition
crash_handler.cpp:141
Generated by
1.12.0