1 #include "binary_sensor.h" 8 static const char *
const TAG =
"binary_sensor";
34 ESP_LOGD(TAG,
"'%s': Sending initial state %s", this->
get_name().c_str(), ONOFF(state));
36 ESP_LOGD(TAG,
"'%s': Sending state %s", this->
get_name().c_str(), ONOFF(state));
53 while (last_filter->
next_ !=
nullptr)
54 last_filter = last_filter->
next_;
55 last_filter->
next_ = filter;
59 for (
Filter *filter : filters) {
void add_filter(Filter *filter)
void publish_initial_state(bool state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
bool next(T value)
Feeds the next item in the series to the deduplicator and returns whether this is a duplicate...
virtual bool is_status_binary_sensor() const
virtual bool has_state() const
Return whether this binary sensor has outputted a state.
void send_state_internal(bool state, bool is_initial)
void input(bool value, bool is_initial)
bool state
The current reported state of the binary sensor.
Deduplicator< bool > publish_dedup_
void publish_state(bool state)
Publish a new state to the front-end.
esphome::binary_sensor::BinarySensor * binary_sensor
void add_filters(const std::vector< Filter *> &filters)
bool publish_initial_state_
CallbackManager< void(bool)> state_callback_
void add_on_state_callback(std::function< void(bool)> &&callback)
Add a callback to be notified of state changes.
Implementation of SPI Controller mode.
const StringRef & get_name() const