HTTP+JSON power meter: value 1 is always enabled

enabling the HTTP+JSON power meter without enabling at least one value
makes no sense, so value 1 has always been treated as "always enabled".
while doing the power meter refactoring, however, a regression was
introduced that would hide the settings for value 1 in the web UI until
the power meter settings would be saved, which they cannot be due to
missing settings for value 1.
This commit is contained in:
Bernhard Kirchen 2024-07-01 22:07:55 +02:00
parent 3fe39d722c
commit b808e9ab18
3 changed files with 3 additions and 2 deletions

View File

@ -338,6 +338,8 @@ void ConfigurationClass::deserializePowerMeterHttpJsonConfig(JsonObject const& s
t.PowerUnit = s["unit"] | PowerMeterHttpJsonValue::Unit::Watts;
t.SignInverted = s["sign_inverted"] | false;
}
target.Values[0].Enabled = true;
}
void ConfigurationClass::deserializePowerMeterHttpSmlConfig(JsonObject const& source, PowerMeterHttpSmlConfig& target)

View File

@ -160,7 +160,6 @@ void WebApiPowerMeterClass::onAdminPost(AsyncWebServerRequest* request)
Configuration.deserializePowerMeterHttpJsonConfig(root["http_json"].as<JsonObject>(),
config.PowerMeter.HttpJson);
config.PowerMeter.HttpJson.Values[0].Enabled = true;
Configuration.deserializePowerMeterHttpSmlConfig(root["http_sml"].as<JsonObject>(),
config.PowerMeter.HttpSml);

View File

@ -144,7 +144,7 @@
v-model="httpJson.enabled"
type="checkbox" wide />
<div v-if="httpJson.enabled">
<div v-if="httpJson.enabled || index == 0">
<HttpRequestSettings v-model="httpJson.http_request" v-if="index == 0 || powerMeterConfigList.http_json.individual_requests"/>