mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
missing disable in lock
This commit is contained in:
@@ -11,6 +11,11 @@ static const char *const TAG = "template.lock";
|
||||
TemplateLock::TemplateLock()
|
||||
: lock_trigger_(new Trigger<>()), unlock_trigger_(new Trigger<>()), open_trigger_(new Trigger<>()) {}
|
||||
|
||||
void TemplateLock::setup() {
|
||||
if (!this->f_.has_value())
|
||||
this->disable_loop();
|
||||
}
|
||||
|
||||
void TemplateLock::loop() {
|
||||
auto val = this->f_();
|
||||
if (val.has_value()) {
|
||||
|
||||
@@ -12,6 +12,7 @@ class TemplateLock : public lock::Lock, public Component {
|
||||
public:
|
||||
TemplateLock();
|
||||
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
template<typename F> void set_state_lambda(F &&f) { this->f_.set(std::forward<F>(f)); }
|
||||
|
||||
Reference in New Issue
Block a user