ESPHome 2025.5.0
Loading...
Searching...
No Matches
output_lock.cpp
Go to the documentation of this file.
1#include "output_lock.h"
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace output {
6
7static const char *const TAG = "output.lock";
8
9void OutputLock::dump_config() { LOG_LOCK("", "Output Lock", this); }
10
12 auto state = *call.get_state();
14 this->output_->turn_on();
15 } else if (state == lock::LOCK_STATE_UNLOCKED) {
16 this->output_->turn_off();
17 }
18 this->publish_state(state);
19}
20
21} // namespace output
22} // namespace esphome
This class is used to encode all control actions on a lock device.
Definition lock.h:71
void publish_state(LockState state)
Publish a state to the front-end from the back-end.
Definition lock.cpp:48
LockState state
The current reported state of the lock.
Definition lock.h:122
virtual void turn_off()
Disable this binary output.
virtual void turn_on()
Enable this binary output.
output::BinaryOutput * output_
Definition output_lock.h:20
void dump_config() override
void control(const lock::LockCall &call) override
@ LOCK_STATE_UNLOCKED
Definition lock.h:29
@ LOCK_STATE_LOCKED
Definition lock.h:28
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7