5 namespace analog_threshold {
7 static const char *
const TAG =
"analog_threshold.binary_sensor";
14 if (std::isnan(sensor_value)) {
26 if (!std::isnan(sensor_value)) {
33 LOG_BINARY_SENSOR(
"",
"Analog Threshold Binary Sensor",
this);
34 LOG_SENSOR(
" ",
"Sensor", this->
sensor_);
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
void publish_initial_state(bool state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
void dump_config() override
void set_sensor(sensor::Sensor *analog_sensor)
bool state
The current reported state of the binary sensor.
void publish_state(bool state)
Publish a new state to the front-end.
float get_state() const
Getter-syntax for .state.
Implementation of SPI Controller mode.
Base-class for all sensors.