ESPHome
2026.10.2
Loading...
Searching...
No Matches
esphome
components
lock
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/lock/lock.h
"
4
#include "
esphome/core/automation.h
"
5
#include "
esphome/core/component.h
"
6
7
namespace
esphome::lock
{
8
11
template
<LockState State>
struct
LockStateForwarder
{
12
Automation<>
*
automation
;
13
void
operator()
(
LockState
state
)
const
{
14
if
(
state
== State)
15
this->automation->
trigger
();
16
}
17
};
18
19
static_assert
(
sizeof
(LockStateForwarder<LockState::LOCK_STATE_LOCKED>) <=
sizeof
(
void
*));
20
static_assert
(std::is_trivially_copyable_v<LockStateForwarder<LockState::LOCK_STATE_LOCKED>>);
21
22
}
// namespace esphome::lock
esphome::Automation<>
esphome::Automation::trigger
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Definition
automation.h:690
component.h
automation.h
state
bool state
Definition
fan.h:2
lock.h
esphome::lock
Definition
automation.h:7
esphome::lock::LockState
LockState
Enum for all states a lock can be in.
Definition
lock.h:23
esphome::lock::LockStateForwarder
Callback forwarder that triggers an Automation<> only when a specific lock state is entered.
Definition
automation.h:11
esphome::lock::LockStateForwarder::automation
Automation * automation
Definition
automation.h:12
esphome::lock::LockStateForwarder::operator()
void operator()(LockState state) const
Definition
automation.h:13
Generated by
1.12.0