Merge pull request #544 from proddy/dev

minor fixes
This commit is contained in:
Proddy
2022-06-06 11:23:23 +02:00
committed by GitHub
7 changed files with 51 additions and 27 deletions

View File

@@ -15,8 +15,8 @@
"@mui/material": "^5.8.2",
"@table-library/react-table-library": "^3.1.5",
"@types/lodash": "^4.14.182",
"@types/node": "^17.0.38",
"@types/react": "^18.0.10",
"@types/node": "^17.0.40",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@types/react-router-dom": "^5.3.3",
"async-validator": "^4.1.1",
@@ -34,7 +34,7 @@
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"sockette": "^2.0.6",
"typescript": "^4.7.2"
"typescript": "^4.7.3"
},
"devDependencies": {
"nodemon": "^2.0.16",
@@ -3951,9 +3951,9 @@
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"node_modules/@types/node": {
"version": "17.0.38",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz",
"integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g=="
"version": "17.0.40",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz",
"integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg=="
},
"node_modules/@types/parse-json": {
"version": "4.0.0",
@@ -3986,9 +3986,9 @@
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"node_modules/@types/react": {
"version": "18.0.10",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.10.tgz",
"integrity": "sha512-dIugadZuIPrRzvIEevIu7A1smqOAjkSMv8qOfwPt9Ve6i6JT/FQcCHyk2qIAxwsQNKZt5/oGR0T4z9h2dXRAkg==",
"version": "18.0.12",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.12.tgz",
"integrity": "sha512-duF1OTASSBQtcigUvhuiTB1Ya3OvSy+xORCiEf20H0P0lzx+/KeVsA99U5UjLXSbyo1DRJDlLKqTeM1ngosqtg==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@@ -16802,9 +16802,9 @@
}
},
"node_modules/typescript": {
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz",
"integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==",
"version": "4.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
"integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -20684,9 +20684,9 @@
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"@types/node": {
"version": "17.0.38",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz",
"integrity": "sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g=="
"version": "17.0.40",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.40.tgz",
"integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg=="
},
"@types/parse-json": {
"version": "4.0.0",
@@ -20719,9 +20719,9 @@
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"@types/react": {
"version": "18.0.10",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.10.tgz",
"integrity": "sha512-dIugadZuIPrRzvIEevIu7A1smqOAjkSMv8qOfwPt9Ve6i6JT/FQcCHyk2qIAxwsQNKZt5/oGR0T4z9h2dXRAkg==",
"version": "18.0.12",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.12.tgz",
"integrity": "sha512-duF1OTASSBQtcigUvhuiTB1Ya3OvSy+xORCiEf20H0P0lzx+/KeVsA99U5UjLXSbyo1DRJDlLKqTeM1ngosqtg==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@@ -29959,9 +29959,9 @@
}
},
"typescript": {
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz",
"integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A=="
"version": "4.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
"integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA=="
},
"unbox-primitive": {
"version": "1.0.2",

View File

@@ -11,8 +11,8 @@
"@mui/material": "^5.8.2",
"@table-library/react-table-library": "^3.1.5",
"@types/lodash": "^4.14.182",
"@types/node": "^17.0.38",
"@types/react": "^18.0.10",
"@types/node": "^17.0.40",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@types/react-router-dom": "^5.3.3",
"async-validator": "^4.1.1",
@@ -30,7 +30,7 @@
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"sockette": "^2.0.6",
"typescript": "^4.7.2"
"typescript": "^4.7.3"
},
"scripts": {
"start": "react-app-rewired start",

View File

@@ -276,7 +276,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
}
}
// call the function baesed on type
// call the function based on type
if (cf->cmdfunction_json_) {
return_code = ((cf->cmdfunction_json_)(value, id, output)) ? CommandRet::OK : CommandRet::ERROR;
}

View File

@@ -81,6 +81,7 @@ class System {
return syslog_enabled_;
}
#ifndef EMSESP_STANDALONE
unsigned long syslog_count() {
return syslog_.message_count();
}
@@ -88,6 +89,7 @@ class System {
unsigned long syslog_fails() {
return syslog_.message_fails();
}
#endif
void led_init(bool refresh);
void network_init(bool refresh);
@@ -189,7 +191,7 @@ class System {
#ifndef EMSESP_STANDALONE
return (ethernet_connected() || WiFi.isConnected());
#else
return true;
return true;
#endif
}

View File

@@ -692,6 +692,25 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp", "59");
}
// https://github.com/emsesp/EMS-ESP32/issues/541
if (command == "api_wwmode") {
shell.printfln(F("Testing API wwmode"));
Mqtt::ha_enabled(false);
Mqtt::nested_format(1);
run_test("310");
AsyncWebServerRequest request;
request.method(HTTP_POST);
DynamicJsonDocument doc(2000);
JsonVariant json;
char data[] = "{\"value\":\"off\"}";
deserializeJson(doc, data);
json = doc.as<JsonVariant>();
request.url("/api/thermostat/wwmode");
EMSESP::webAPIService.webAPIService_post(&request, json);
}
if (command == "api") {
shell.printfln(F("Testing API with MQTT and REST, standalone"));

View File

@@ -48,8 +48,9 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "2thermostats"
// #define EMSESP_DEBUG_DEFAULT "dallas"
// #define EMSESP_DEBUG_DEFAULT "analog"
#define EMSESP_DEBUG_DEFAULT "api_values"
// #define EMSESP_DEBUG_DEFAULT "api_values"
// #define EMSESP_DEBUG_DEFAULT "mqtt_post"
#define EMSESP_DEBUG_DEFAULT "api_wwmode"
class Test {
public:

View File

@@ -187,6 +187,7 @@ void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
statJson["q"] =
WebAPIService::api_count() == 0 ? 100 : 100 - (uint8_t)((100 * WebAPIService::api_fails()) / (WebAPIService::api_count() + WebAPIService::api_fails()));
#ifndef EMSESP_STANDALONE
if (EMSESP::system_.syslog_enabled()) {
statJson = statsJson.createNestedObject();
statJson["id"] = "Syslog Messages";
@@ -196,6 +197,7 @@ void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
? 100
: 100 - (uint8_t)((100 * EMSESP::system_.syslog_fails()) / (EMSESP::system_.syslog_count() + EMSESP::system_.syslog_fails()));
}
#endif
response->setLength();
request->send(response);