Merge branch 'dev' into dev

This commit is contained in:
Proddy
2024-04-21 15:29:19 +02:00
committed by GitHub
36 changed files with 757 additions and 753 deletions

View File

@@ -102,8 +102,8 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
if (request->hasParam(F_(hc))) {
input["hc"] = Helpers::atoint(request->getParam(F_(hc))->value().c_str());
}
if (request->hasParam(F_(wwc))) {
input["wwc"] = Helpers::atoint(request->getParam(F_(wwc))->value().c_str());
if (request->hasParam(F_(dhw))) {
input["dhw"] = Helpers::atoint(request->getParam(F_(dhw))->value().c_str());
}
}

View File

@@ -561,9 +561,14 @@ void WebCustomEntityService::fetch() {
for (auto & entity : *customEntityItems) {
if (entity.device_id > 0 && entity.type_id > 0) { // ths excludes also RAM type
bool needFetch = true;
bool needFetch = true;
uint8_t fetchblock = entity.type_id > 0x0FF ? 25 : 27;
uint8_t start = entity.offset % fetchblock;
uint8_t stop = (entity.offset + len[entity.value_type]) % fetchblock;
bool is_fetched = start < fetchblock && stop < fetchblock; // make sure the complete value is a a fetched block
for (const auto & emsdevice : EMSESP::emsdevices) {
if (entity.value_type != DeviceValueType::STRING && emsdevice->is_device_id(entity.device_id) && emsdevice->is_fetch(entity.type_id)) {
if (entity.value_type != DeviceValueType::STRING && emsdevice->is_device_id(entity.device_id) && emsdevice->is_fetch(entity.type_id)
&& is_fetched) {
needFetch = false;
break;
}

View File

@@ -236,9 +236,9 @@ void WebDataService::write_device_value(AsyncWebServerRequest * request, JsonVar
// using the unique ID from the web find the real device type
for (const auto & emsdevice : EMSESP::emsdevices) {
if (emsdevice->unique_id() == unique_id) {
// parse the command as it could have a hc or wwc prefixed, e.g. hc2/seltemp
// parse the command as it could have a hc or dhw prefixed, e.g. hc2/seltemp
int8_t id = -1; // default
cmd = Command::parse_command_string(cmd, id); // extract hc or wwc
cmd = Command::parse_command_string(cmd, id); // extract hc or dhw
// create JSON for output
auto * response = new AsyncJsonResponse(false);
@@ -278,7 +278,7 @@ void WebDataService::write_device_value(AsyncWebServerRequest * request, JsonVar
// special check for custom entities (which have a unique id of 99)
if (unique_id == 99) {
// parse the command as it could have a hc or wwc prefixed, e.g. hc2/seltemp
// parse the command as it could have a hc or dhw prefixed, e.g. hc2/seltemp
int8_t id = -1;
cmd = Command::parse_command_string(cmd, id);
auto * response = new AsyncJsonResponse(false);