ESPHome  2024.12.2
template_lock.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace template_ {
9 
10 class TemplateLock : public lock::Lock, public Component {
11  public:
12  TemplateLock();
13 
14  void dump_config() override;
15 
16  void set_state_lambda(std::function<optional<lock::LockState>()> &&f);
17  Trigger<> *get_lock_trigger() const;
19  Trigger<> *get_open_trigger() const;
20  void set_optimistic(bool optimistic);
21  void loop() override;
22 
23  float get_setup_priority() const override;
24 
25  protected:
26  void control(const lock::LockCall &call) override;
27  void open_latch() override;
28 
30  bool optimistic_{false};
35 };
36 
37 } // namespace template_
38 } // namespace esphome
This class is used to encode all control actions on a lock device.
Definition: lock.h:71
void set_optimistic(bool optimistic)
void set_state_lambda(std::function< optional< lock::LockState >()> &&f)
Trigger * get_unlock_trigger() const
float get_setup_priority() const override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void control(const lock::LockCall &call) override
optional< std::function< optional< lock::LockState >)> > f_
Definition: template_lock.h:29
Base class for all locks.
Definition: lock.h:103