add test for #541

This commit is contained in:
proddy
2022-06-06 11:19:56 +02:00
parent d162206f75
commit 98fb970dac
2 changed files with 21 additions and 1 deletions

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: