ESPHome
2025.9.0-dev
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
{
8
namespace
interval {
9
10
class
IntervalTrigger
:
public
Trigger
<>,
public
PollingComponent
{
11
public
:
12
void
update
()
override
{ this->
trigger
(); }
13
14
void
setup
()
override
{
15
if
(this->
startup_delay_
!= 0) {
16
this->
stop_poller
();
17
this->
set_timeout
(this->
startup_delay_
, [
this
] { this->
start_poller
(); });
18
}
19
}
20
21
void
set_startup_delay
(
const
uint32_t startup_delay) { this->
startup_delay_
= startup_delay; }
22
23
protected
:
24
uint32_t
startup_delay_
{0};
25
};
26
27
}
// namespace interval
28
}
// namespace esphome
esphome::Component::set_timeout
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Definition
component.cpp:114
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:425
esphome::PollingComponent::start_poller
void start_poller()
Definition
component.cpp:389
esphome::PollingComponent::stop_poller
void stop_poller()
Definition
component.cpp:394
esphome::Trigger
Definition
automation.h:142
esphome::Trigger<>::trigger
void trigger(Ts... x)
Definition
automation.h:145
esphome::interval::IntervalTrigger
Definition
interval.h:10
esphome::interval::IntervalTrigger::set_startup_delay
void set_startup_delay(const uint32_t startup_delay)
Definition
interval.h:21
esphome::interval::IntervalTrigger::update
void update() override
Definition
interval.h:12
esphome::interval::IntervalTrigger::setup
void setup() override
Definition
interval.h:14
esphome::interval::IntervalTrigger::startup_delay_
uint32_t startup_delay_
Definition
interval.h:24
component.h
automation.h
log.h
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
Generated by
1.12.0