ESPHome  2024.10.2
copy_lock.cpp
Go to the documentation of this file.
1 #include "copy_lock.h"
2 #include "esphome/core/log.h"
3 
4 namespace esphome {
5 namespace copy {
6 
7 static const char *const TAG = "copy.lock";
8 
11 
16 
17  this->publish_state(source_->state);
18 }
19 
20 void CopyLock::dump_config() { LOG_LOCK("", "Copy Lock", this); }
21 
23  auto call2 = source_->make_call();
24  call2.set_state(call.get_state());
25  call2.perform();
26 }
27 
28 } // namespace copy
29 } // namespace esphome
LockCall & set_state(LockState state)
Set the state of the lock device.
Definition: lock.cpp:78
void set_supported_states(std::set< LockState > states)
Definition: lock.h:49
std::set< LockState > get_supported_states() const
Definition: lock.h:48
LockState state
The current reported state of the lock.
Definition: lock.h:122
void control(const lock::LockCall &call) override
Definition: copy_lock.cpp:22
const optional< LockState > & get_state() const
Definition: lock.cpp:104
LockCall make_call()
Make a lock device control call, this is used to control the lock device, see the LockCall descriptio...
Definition: lock.cpp:28
void dump_config() override
Definition: copy_lock.cpp:20
void set_supports_open(bool supports_open)
Definition: lock.h:41
void set_assumed_state(bool assumed_state)
Definition: lock.h:45
void setup() override
Definition: copy_lock.cpp:9
void add_on_state_callback(std::function< void()> &&callback)
Set callback for state changes.
Definition: lock.cpp:58
This class is used to encode all control actions on a lock device.
Definition: lock.h:71
LockTraits traits
Definition: lock.h:124
bool get_assumed_state() const
Definition: lock.h:44
bool get_requires_code() const
Definition: lock.h:42
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_requires_code(bool requires_code)
Definition: lock.h:43
lock::Lock * source_
Definition: copy_lock.h:19
bool get_supports_open() const
Definition: lock.h:40
void publish_state(LockState state)
Publish a state to the front-end from the back-end.
Definition: lock.cpp:48