12 read_delay{read_delay},
13 output_scale{output_scale} {
18void AnalogInput::update() { this->
emit(output_scale * analog_reader->
read()); }
22 ReactESP::app->onRepeat(read_delay, [
this]() { this->update(); });
27 root[
"read_delay"] = read_delay;
30static const char SCHEMA[]
PROGMEM = R
"###({
33 "read_delay": { "title": "Read delay", "type": "number", "description": "Number of milliseconds between each analogRead(A0)" }
37String AnalogInput::get_config_schema() { return FPSTR(SCHEMA); }
39bool AnalogInput::set_configuration(
const JsonObject& config) {
40 String expected[] = {
"read_delay"};
41 for (
auto str : expected) {
42 if (!config.containsKey(str)) {
46 read_delay = config[
"read_delay"];
virtual bool configure()=0
virtual void load_configuration()
Sensor template class for any sensor producing actual values.
const uint8_t PAGE_css_bootstrap[] PROGMEM
ESP32AnalogReader AnalogReader