6 const String& config_path)
8 max_voltage_{max_voltage},
9 multiplier_{multiplier},
20 root[
"max_voltage"] = max_voltage_;
21 root[
"multiplier"] = multiplier_;
22 root[
"offset"] = offset_;
27 const String expected[] = {
"max_voltage",
"multiplier",
"offset"};
28 for (
auto str : expected) {
29 if (!config[str].is<JsonVariant>()) {
33 max_voltage_ = config[
"max_voltage"];
34 multiplier_ = config[
"multiplier"];
35 offset_ = config[
"offset"];
40 return R
"###({"type":"object","properties":{"max_voltage":{"title":"Max voltage","type":"number","description":"The maximum voltage allowed into your ESP's Analog Input pin"},"multiplier":{"title":"Multiplier","type":"number","description":"Output will be multiplied by this before sending to SK"},"offset":{"title":"Offset","type":"number","description":"This will be added to output before sending to SK"}}})###";
#define MAX_ANALOG_OUTPUT
A transform that takes the output of an analog-to-digital converter and outputs the voltage that went...
virtual bool to_json(JsonObject &root) override
virtual void set(const float &input) override
AnalogVoltage(float max_voltage=3.3, float multiplier=1.0, float offset=0.0, const String &config_path="")
virtual bool from_json(const JsonObject &config) override
virtual bool load() override
Load and populate the object from a persistent storage.
void emit(const float &new_value)
const String ConfigSchema(const SmartSwitchController &obj)