ESPHome 2025.5.0
Loading...
Searching...
No Matches
switch_binary_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace switch_ {
6
7static const char *const TAG = "switch.binary_sensor";
8
10 source_->add_on_state_callback([this](bool value) { this->publish_state(value); });
12}
13
14void SwitchBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Switch Binary Sensor", this); }
15
16} // namespace switch_
17} // namespace esphome
void publish_state(bool state)
Publish a new state to the front-end.
bool state
The current reported state of the binary sensor.
Definition switch.h:53
void add_on_state_callback(std::function< void(bool)> &&callback)
Set callback for state changes.
Definition switch.cpp:60
const char *const TAG
Definition spi.cpp:8
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7