ESPHome 2025.5.0
Loading...
Searching...
No Matches
mqtt_binary_sensor.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_MQTT
5#ifdef USE_BINARY_SENSOR
6
7#include "mqtt_component.h"
9
10namespace esphome {
11namespace mqtt {
12
14 public:
20
21 void setup() override;
22
23 void dump_config() override;
24
25 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
26
27 void set_is_status(bool status);
28
29 bool send_initial_state() override;
30 bool publish_state(bool state);
31
32 protected:
33 std::string component_type() const override;
34 const EntityBase *get_entity() const override;
35
37};
38
39} // namespace mqtt
40} // namespace esphome
41
42#endif
43#endif // USE_MQTT
Base class for all binary_sensor-type classes.
MQTTBinarySensorComponent(binary_sensor::BinarySensor *binary_sensor)
Construct a MQTTBinarySensorComponent.
const EntityBase * get_entity() const override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
std::string component_type() const override
binary_sensor::BinarySensor * binary_sensor_
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Simple Helper struct used for Home Assistant MQTT send_discovery().