ESPHome  2024.9.2
output_lock.cpp
Go to the documentation of this file.
1 #include "output_lock.h"
2 #include "esphome/core/log.h"
3 
4 namespace esphome {
5 namespace output {
6 
7 static const char *const TAG = "output.lock";
8 
9 void 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
virtual void turn_on()
Enable this binary output.
Definition: binary_output.h:43
LockState state
The current reported state of the lock.
Definition: lock.h:122
const optional< LockState > & get_state() const
Definition: lock.cpp:104
virtual void turn_off()
Disable this binary output.
Definition: binary_output.h:51
This class is used to encode all control actions on a lock device.
Definition: lock.h:71
void dump_config() override
Definition: output_lock.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
output::BinaryOutput * output_
Definition: output_lock.h:20
void publish_state(LockState state)
Publish a state to the front-end from the back-end.
Definition: lock.cpp:48
void control(const lock::LockCall &call) override
Definition: output_lock.cpp:11