mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
changes for standalone compilation
This commit is contained in:
@@ -90,8 +90,8 @@ class PrettyAsyncJsonResponse {
|
|||||||
class MsgpackAsyncJsonResponse {
|
class MsgpackAsyncJsonResponse {
|
||||||
protected:
|
protected:
|
||||||
DynamicJsonDocument _jsonBuffer;
|
DynamicJsonDocument _jsonBuffer;
|
||||||
JsonVariant _root;
|
JsonVariant _root;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MsgpackAsyncJsonResponse(bool isArray = false, size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE)
|
MsgpackAsyncJsonResponse(bool isArray = false, size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE)
|
||||||
@@ -187,6 +187,7 @@ class AsyncCallbackJsonWebHandler : public AsyncWebHandler {
|
|||||||
ArJsonRequestHandlerFunction _onRequest;
|
ArJsonRequestHandlerFunction _onRequest;
|
||||||
size_t _contentLength;
|
size_t _contentLength;
|
||||||
size_t _maxContentLength;
|
size_t _maxContentLength;
|
||||||
|
size_t _maxJsonBufferSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AsyncCallbackJsonWebHandler(const String & uri, ArJsonRequestHandlerFunction onRequest, size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE)
|
AsyncCallbackJsonWebHandler(const String & uri, ArJsonRequestHandlerFunction onRequest, size_t maxJsonBufferSize = DYNAMIC_JSON_DOCUMENT_SIZE)
|
||||||
@@ -202,6 +203,9 @@ class AsyncCallbackJsonWebHandler : public AsyncWebHandler {
|
|||||||
void setMaxContentLength(int maxContentLength) {
|
void setMaxContentLength(int maxContentLength) {
|
||||||
_maxContentLength = maxContentLength;
|
_maxContentLength = maxContentLength;
|
||||||
}
|
}
|
||||||
|
void setMaxJsonBufferSize(int maxJsonBufferSize) {
|
||||||
|
_maxJsonBufferSize = maxJsonBufferSize;
|
||||||
|
}
|
||||||
void onRequest(ArJsonRequestHandlerFunction fn) {
|
void onRequest(ArJsonRequestHandlerFunction fn) {
|
||||||
_onRequest = fn;
|
_onRequest = fn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -926,7 +926,7 @@ rest_server.post(EMSESP_DEVICEENTITIES_ENDPOINT, (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
rest_server.post(EMSESP_EXCLUDE_ENTITIES_ENDPOINT, (req, res) => {
|
rest_server.post(EMSESP_EXCLUDE_ENTITIES_ENDPOINT, (req, res) => {
|
||||||
console.log('exclude list for productid ' + req.body.product_id + ' device_id ' + req.body.device_id + ' entities:')
|
console.log('exclude list for unique id ' + req.body.id + ' and entities:')
|
||||||
console.log(req.body.entity_ids)
|
console.log(req.body.entity_ids)
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1253,7 +1253,9 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
|||||||
}
|
}
|
||||||
if (!ntp_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
|
if (!ntp_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
|
||||||
struct timeval newnow = {.tv_sec = ttime};
|
struct timeval newnow = {.tv_sec = ttime};
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
settimeofday(&newnow, nullptr);
|
settimeofday(&newnow, nullptr);
|
||||||
|
#endif
|
||||||
LOG_INFO(F("ems-esp time set from thermostat"));
|
LOG_INFO(F("ems-esp time set from thermostat"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -768,7 +768,7 @@ void EMSdevice::mask_entity(std::string entity_id) {
|
|||||||
std::string entity = dv.tag < DeviceValueTAG::TAG_HC1 ? read_flash_string(dv.short_name) : tag_to_string(dv.tag) + "/" + read_flash_string(dv.short_name);
|
std::string entity = dv.tag < DeviceValueTAG::TAG_HC1 ? read_flash_string(dv.short_name) : tag_to_string(dv.tag) + "/" + read_flash_string(dv.short_name);
|
||||||
if (entity == entity_id.substr(2)) {
|
if (entity == entity_id.substr(2)) {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
#if defined(EMSESP_USE_SERIAL)
|
||||||
Serial.print("exclude_entity() Removing Visible for device value: ");
|
Serial.print("mask_entity() Removing Visible for device value: ");
|
||||||
Serial.println(read_flash_string(dv.full_name).c_str());
|
Serial.println(read_flash_string(dv.full_name).c_str());
|
||||||
#endif
|
#endif
|
||||||
dv.state = (dv.state & 0x0F) | (flag << 4); // set state high bits to flag, turn off active and ha flags
|
dv.state = (dv.state & 0x0F) | (flag << 4); // set state high bits to flag, turn off active and ha flags
|
||||||
|
|||||||
@@ -609,8 +609,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
// toggle mode
|
// toggle mode
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice->unique_id() == 1) { // boiler
|
if (emsdevice->unique_id() == 1) { // boiler
|
||||||
uint8_t entity_id = 47; // wwseltemp
|
emsdevice->mask_entity("07wwseltemp");
|
||||||
emsdevice->exclude_entity(entity_id);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user