ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
copy_binary_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3
4namespace esphome::copy {
5
6static const char *const TAG = "copy.binary_sensor";
7
9 source_->add_on_state_callback([this](bool value) { this->publish_state(value); });
10 if (source_->has_state())
12}
13
14void CopyBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Copy Binary Sensor", this); }
15
16} // namespace esphome::copy
bool has_state() const
void add_on_state_callback(F &&callback)
void publish_state(bool new_state)
Publish a new state to the front-end.
bool state
The current state of this binary sensor. Also used as the backing storage for StatefulEntityBase.
binary_sensor::BinarySensor * source_