9 multiplier_{multiplier},
10 last_update_(millis()) {
15 uint64_t
const cur_millis = millis();
16 uint64_t
const elapsed_millis = cur_millis - last_update_;
17 last_update_ = cur_millis;
18 this->
emit(multiplier_ * input / (elapsed_millis / 1000.));
22 root[
"multiplier"] = multiplier_;
27 String
const expected[] = {
"multiplier"};
28 for (
auto str : expected) {
29 if (!config[str].is<JsonVariant>()) {
33 multiplier_ = config[
"multiplier"];
38 return R
"###({"type":"object","properties":{"multiplier":{"title":"Multiplier","type":"number"}}})###";
virtual bool load() override
Load and populate the object from a persistent storage.
Transforms its input into frequency (Hz: cycles per second)
virtual bool from_json(const JsonObject &config) override
virtual void set(const int &input) override
virtual bool to_json(JsonObject &root) override
Frequency(float multiplier=1, const String &config_path="")
void emit(const float &new_value)
const String ConfigSchema(const SmartSwitchController &obj)