6namespace binary_sensor {
8static 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) {
bool next(T value)
Feeds the next item in the series to the deduplicator and returns whether this is a duplicate.
const StringRef & get_name() const
void add_filters(const std::vector< Filter * > &filters)
virtual bool has_state() const
Return whether this binary sensor has outputted a state.
void publish_initial_state(bool state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
Deduplicator< bool > publish_dedup_
bool state
The current reported state of the binary sensor.
CallbackManager< void(bool)> state_callback_
void send_state_internal(bool state, bool is_initial)
void add_on_state_callback(std::function< void(bool)> &&callback)
Add a callback to be notified of state changes.
void add_filter(Filter *filter)
bool publish_initial_state_
virtual bool is_status_binary_sensor() const
void publish_state(bool state)
Publish a new state to the front-end.
void input(bool value, bool is_initial)
Providing packet encoding functions for exchanging data with a remote host.