9#ifdef USE_BINARY_SENSOR
16 SUB_SENSOR(last_duty_time)
19 void setup()
override;
20 void update()
override;
22 void dump_config()
override;
26 bool is_running()
const {
return this->
last_state_; }
29#ifdef USE_BINARY_SENSOR
32 void set_lambda(std::function<
bool()> &&func) { this->
func_ = std::move(func); }
33 void set_restore(
bool restore) { this->
restore_ = restore; }
40 std::function<bool()>
func_{
nullptr};
virtual void setup()
Where the component's initialization should happen.
This class simplifies creating components that periodically check a state.
Base class for all binary_sensor-type classes.
std::function< bool()> func_
void publish_and_save_(uint32_t sec, uint32_t ms)
ESPPreferenceObject pref_
void process_state_(bool state)
void set_value_(uint32_t sec)
Base-class for all sensors.
float state
This member variable stores the last state that has passed through all filters.