1#ifndef SENSESP_TRANSFORMS_DEBOUNCE_H_
2#define SENSESP_TRANSFORMS_DEBOUNCE_H_
34 Debounce(
int ms_min_delay = 15, String config_path =
"")
34 Debounce(
int ms_min_delay = 15, String config_path =
"") {
…}
39 virtual void set(
const T& input)
override {
39 virtual void set(
const T& input)
override {
…}
59 virtual bool to_json(JsonObject& doc)
override {
59 virtual bool to_json(JsonObject& doc)
override {
…}
64 virtual bool from_json(
const JsonObject& config)
override {
65 const String expected[] = {
"min_delay"};
66 for (
auto str : expected) {
67 if (!config[str].is<JsonVariant>()) {
64 virtual bool from_json(
const JsonObject& config)
override {
…}
79 reactesp::DelayEvent*
event_ =
nullptr;
84 return R
"###({"type":"object","properties":{"min_delay":{"title":"Minimum delay","type":"number","description":"The minimum time in ms between inputs for output to happen"}}})###";
Implements debounce code for a button or switch.
reactesp::DelayEvent * event_
Debounce(int ms_min_delay=15, String config_path="")
virtual bool to_json(JsonObject &doc) override
virtual bool from_json(const JsonObject &config) override
virtual void set(const T &input) override
virtual bool load() override
Load and populate the object from a persistent storage.
void emit(const T &new_value)
const String ConfigSchema(const SmartSwitchController &obj)
std::shared_ptr< reactesp::EventLoop > event_loop()
Debounce< float > DebounceFloat
Debounce< bool > DebounceBool
Debounce< int > DebounceInt