8namespace binary_sensor {
10static const char *
const TAG =
"binary_sensor";
38 this->
state = new_state;
41 ESP_LOGD(TAG,
"'%s': New state is %s", this->
get_name().c_str(), ONOFF(new_state));
42#if defined(USE_BINARY_SENSOR) && defined(USE_CONTROLLER_REGISTRY)
54 while (last_filter->
next_ !=
nullptr)
55 last_filter = last_filter->
next_;
56 last_filter->
next_ = filter;
60 for (
Filter *filter : filters) {
static void notify_binary_sensor_update(binary_sensor::BinarySensor *obj)
StringRef get_device_class_ref() const
Get the device class as StringRef.
const StringRef & get_name() const
bool set_state_(const optional< bool > &state)
constexpr const char * c_str() const
constexpr bool empty() const
Base class for all binary_sensor-type classes.
void add_filters(std::initializer_list< Filter * > filters)
void publish_state(bool new_state)
Publish a new state to the front-end.
void send_state_internal(bool new_state)
void publish_initial_state(bool new_state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
void add_filter(Filter *filter)
virtual bool is_status_binary_sensor() const
Return whether this binary sensor has outputted a state.
virtual void input(bool value)
void log_binary_sensor(const char *tag, const char *prefix, const char *type, BinarySensor *obj)
Providing packet encoding functions for exchanging data with a remote host.