14 #define LOG_BINARY_SENSOR(prefix, type, obj) \ 15 if ((obj) != nullptr) { \ 16 ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \ 17 if (!(obj)->get_device_class().empty()) { \ 18 ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \ 22 #define SUB_BINARY_SENSOR(name) \ 24 binary_sensor::BinarySensor *name##_binary_sensor_{nullptr}; \ 27 void set_##name##_binary_sensor(binary_sensor::BinarySensor *binary_sensor) { \ 28 this->name##_binary_sensor_ = binary_sensor; \ 64 void add_filters(
const std::vector<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...
virtual bool is_status_binary_sensor() const
bool has_state() const override
void set_publish_initial_state(bool publish_initial_state)
virtual bool has_state() const
Return whether this binary sensor has outputted a state.
void send_state_internal(bool state, 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.
Base class for all binary_sensor-type classes.