mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 12:43:28 +02:00
21803607e7
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
23 lines
541 B
C++
23 lines
541 B
C++
#include "output_lock.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome {
|
|
namespace output {
|
|
|
|
static const char *const TAG = "output.lock";
|
|
|
|
void OutputLock::dump_config() { LOG_LOCK("", "Output Lock", this); }
|
|
|
|
void OutputLock::control(const lock::LockCall &call) {
|
|
auto state = *call.get_state();
|
|
if (state == lock::LOCK_STATE_LOCKED) {
|
|
this->output_->turn_on();
|
|
} else if (state == lock::LOCK_STATE_UNLOCKED) {
|
|
this->output_->turn_off();
|
|
}
|
|
this->publish_state(state);
|
|
}
|
|
|
|
} // namespace output
|
|
} // namespace esphome
|