1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 14:22:21 +01:00

Revert "more"

This reverts commit ef0e93a9cb.
This commit is contained in:
J. Nick Koston
2025-09-05 11:12:15 -05:00
parent ef0e93a9cb
commit 4321fc86c2

View File

@@ -307,7 +307,7 @@ std::string WebServer::get_config_json() {
root[F("ota")] = true; root[F("ota")] = true;
#endif #endif
root[F("log")] = this->expose_log_; root[F("log")] = this->expose_log_;
root[F("lang")] = F("en"); root[F("lang")] = "en";
}); });
} }
@@ -802,12 +802,12 @@ std::string WebServer::light_all_json_generator(WebServer *web_server, void *sou
std::string WebServer::light_json(light::LightState *obj, JsonDetail start_config) { std::string WebServer::light_json(light::LightState *obj, JsonDetail start_config) {
return json::build_json([this, obj, start_config](JsonObject root) { return json::build_json([this, obj, start_config](JsonObject root) {
set_json_id(root, obj, "light-" + obj->get_object_id(), start_config); set_json_id(root, obj, "light-" + obj->get_object_id(), start_config);
root[F("state")] = obj->remote_values.is_on() ? F("ON") : F("OFF"); root[F("state")] = obj->remote_values.is_on() ? "ON" : "OFF";
light::LightJSONSchema::dump_json(*obj, root); light::LightJSONSchema::dump_json(*obj, root);
if (start_config == DETAIL_ALL) { if (start_config == DETAIL_ALL) {
JsonArray opt = root[F("effects")].to<JsonArray>(); JsonArray opt = root[F("effects")].to<JsonArray>();
opt.add(F("None")); opt.add("None");
for (auto const &option : obj->get_effects()) { for (auto const &option : obj->get_effects()) {
opt.add(option->get_name()); opt.add(option->get_name());
} }
@@ -942,8 +942,8 @@ std::string WebServer::number_json(number::Number *obj, float value, JsonDetail
this->add_sorting_info_(root, obj); this->add_sorting_info_(root, obj);
} }
if (std::isnan(value)) { if (std::isnan(value)) {
root[F("value")] = F("\"NaN\""); root[F("value")] = "\"NaN\"";
root[F("state")] = F("NA"); root[F("state")] = "NA";
} else { } else {
root[F("value")] = value_accuracy_to_string(value, step_to_accuracy_decimals(obj->traits.get_step())); root[F("value")] = value_accuracy_to_string(value, step_to_accuracy_decimals(obj->traits.get_step()));
std::string state = value_accuracy_to_string(value, step_to_accuracy_decimals(obj->traits.get_step())); std::string state = value_accuracy_to_string(value, step_to_accuracy_decimals(obj->traits.get_step()));
@@ -1167,7 +1167,7 @@ std::string WebServer::text_json(text::Text *obj, const std::string &value, Json
root[F("max_length")] = obj->traits.get_max_length(); root[F("max_length")] = obj->traits.get_max_length();
root[F("pattern")] = obj->traits.get_pattern(); root[F("pattern")] = obj->traits.get_pattern();
if (obj->traits.get_mode() == text::TextMode::TEXT_MODE_PASSWORD) { if (obj->traits.get_mode() == text::TextMode::TEXT_MODE_PASSWORD) {
root[F("state")] = F("********"); root[F("state")] = "********";
} else { } else {
root[F("state")] = value; root[F("state")] = value;
} }
@@ -1353,7 +1353,7 @@ std::string WebServer::climate_json(climate::Climate *obj, JsonDetail start_conf
if (!std::isnan(obj->current_temperature)) { if (!std::isnan(obj->current_temperature)) {
root[F("current_temperature")] = value_accuracy_to_string(obj->current_temperature, current_accuracy); root[F("current_temperature")] = value_accuracy_to_string(obj->current_temperature, current_accuracy);
} else { } else {
root[F("current_temperature")] = F("NA"); root[F("current_temperature")] = "NA";
} }
} }
if (traits.get_supports_two_point_target_temperature()) { if (traits.get_supports_two_point_target_temperature()) {