ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
template_binary_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace template_ {
6
7static const char *const TAG = "template.binary_sensor";
8
10
12 if (this->f_ == nullptr)
13 return;
14
15 auto s = this->f_();
16 if (s.has_value()) {
17 this->publish_state(*s);
18 }
19}
20void TemplateBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Template Binary Sensor", this); }
21
22} // namespace template_
23} // namespace esphome
void publish_state(bool new_state)
Publish a new state to the front-end.
std::function< optional< bool >()> f_
const char *const TAG
Definition spi.cpp:8
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7