mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
reload values after write and update
This commit is contained in:
@@ -100,6 +100,11 @@ void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant &
|
||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||
if (emsdevice) {
|
||||
if (emsdevice->unique_id() == json["id"]) {
|
||||
// wait max 2.5 sec for updated data (post_send_delay is 2 sec)
|
||||
for (uint16_t i = 0; i < 2500 && EMSESP::wait_validate(); i++) {
|
||||
delay(1);
|
||||
}
|
||||
EMSESP::wait_validate(0); // reset in case of timeout
|
||||
#ifndef EMSESP_STANDALONE
|
||||
JsonObject root = response->getRoot();
|
||||
emsdevice->generate_values_json_web(root);
|
||||
@@ -166,7 +171,7 @@ void WebDataService::write_sensor(AsyncWebServerRequest * request, JsonVariant &
|
||||
// if valid add.
|
||||
uint8_t no = sensor["no"];
|
||||
if (no > 0 && no < 100) {
|
||||
char name[25];
|
||||
char name[20];
|
||||
std::string id = sensor["id"];
|
||||
strlcpy(name, id.c_str(), sizeof(name));
|
||||
float offset = sensor["offset"]; // this will be a float value. We'll convert it to int and * 10 it
|
||||
|
||||
Reference in New Issue
Block a user