ESPHome 2026.1.5
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::mqtt {
11
13 public:
19
20 void setup() override;
21
22 void dump_config() override;
23
24 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
25
26 void set_is_status(bool status);
27
28 bool send_initial_state() override;
29 bool publish_state(bool state);
30
31 protected:
32 const char *component_type() const override;
33 const EntityBase *get_entity() const override;
34
36};
37
38} // namespace esphome::mqtt
39
40#endif
41#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
binary_sensor::BinarySensor * binary_sensor_
const char * component_type() const override
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
bool state
Definition fan.h:0
Simple Helper struct used for Home Assistant MQTT send_discovery().