ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
demo_lock.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace esphome::demo {
6
7class DemoLock : public lock::Lock {
8 protected:
9 void control(const lock::LockCall &call) override {
10 auto state = call.get_state();
11 if (state.has_value())
12 this->publish_state(*state);
13 }
14};
15
16} // namespace esphome::demo
void control(const lock::LockCall &call) override
Definition demo_lock.h:9
This class is used to encode all control actions on a lock device.
Definition lock.h:79
const optional< LockState > & get_state() const
Definition lock.cpp:99
Base class for all locks.
Definition lock.h:112
void publish_state(LockState state)
Publish a state to the front-end from the back-end.
Definition lock.cpp:39
LockState state
The current reported state of the lock.
Definition lock.h:131