ESPHome  2024.11.3
mqtt_lock.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 
5 #ifdef USE_MQTT
6 #ifdef USE_LOCK
7 
9 #include "mqtt_component.h"
10 
11 namespace esphome {
12 namespace mqtt {
13 
15  public:
16  explicit MQTTLockComponent(lock::Lock *a_lock);
17 
18  // ========== INTERNAL METHODS ==========
19  // (In most use cases you won't need these)
20  void setup() override;
21  void dump_config() override;
22 
23  void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
24 
25  bool send_initial_state() override;
26 
27  bool publish_state();
28 
29  protected:
31  std::string component_type() const override;
32  const EntityBase *get_entity() const override;
33 
35 };
36 
37 } // namespace mqtt
38 } // namespace esphome
39 
40 #endif
41 #endif // USE_MQTT
std::string component_type() const override
"lock" component type.
Definition: mqtt_lock.cpp:38
Simple Helper struct used for Home Assistant MQTT send_discovery().
const EntityBase * get_entity() const override
Definition: mqtt_lock.cpp:39
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_lock.cpp:40
MQTTLockComponent(lock::Lock *a_lock)
Definition: mqtt_lock.cpp:16
bool send_initial_state() override
Definition: mqtt_lock.cpp:46
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all locks.
Definition: lock.h:103
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...