diff --git a/src/emsdevice.h b/src/emsdevice.h index a9edbab18..bd414aa0d 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -89,7 +89,7 @@ enum DeviceValueTAG : uint8_t { TAG_NONE = 0, // wild card TAG_HEARTBEAT, TAG_BOILER_DATA, - TAG_DEVICE_DATA_WW, + TAG_BOILER_DATA_WW, TAG_THERMOSTAT_DATA, TAG_HC1, TAG_HC2, @@ -119,7 +119,7 @@ enum DeviceValueTAG : uint8_t { }; // mqtt flags for command subscriptions -enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_WW, FLAG_NOSUB }; +enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_NOSUB }; // mqtt-HA flags enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE }; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 0c7a0f705..e93ace3a8 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -460,8 +460,8 @@ void EMSESP::publish_device_values(uint8_t device_type) { Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_BOILER_DATA), json); } doc.clear(); - if (emsdevice->generate_values_json(json, DeviceValueTAG::TAG_DEVICE_DATA_WW, false)) { - Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_DEVICE_DATA_WW), json); + if (emsdevice->generate_values_json(json, DeviceValueTAG::TAG_BOILER_DATA_WW, false)) { + Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_BOILER_DATA_WW), json); } need_publish = false; } @@ -561,6 +561,7 @@ void EMSESP::publish_response(std::shared_ptr telegram) { Mqtt::publish(F_(response), doc.as()); } +// builds json with the detail of each value, for all device types and the dallas sensor bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype) { for (const auto & emsdevice : emsdevices) { if (emsdevice->device_type() == devicetype) { diff --git a/src/test/test.cpp b/src/test/test.cpp index db27da909..18b908d53 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -53,7 +53,7 @@ bool Test::run_test(const char * command, int8_t id) { return true; } - if (strcmp(command, "general2") == 0) { + if (strcmp(command, "310") == 0) { EMSESP::logger().info(F("Testing GB072/RC310...")); add_device(0x08, 123); // GB072 @@ -74,6 +74,9 @@ bool Test::run_test(const char * command, int8_t id) { uart_telegram({0x10, 00, 0xFF, 00, 01, 0xA5, 0x80, 00, 01, 0x30, 0x28, 00, 0x30, 0x28, 01, 0x54, 03, 03, 01, 01, 0x54, 02, 0xA8, 00, 00, 0x11, 01, 03, 0xFF, 0xFF, 00}); + // RC300WWmode2(0x31D), data: 00 00 09 07 + uart_telegram({0x10, 00, 0xFF, 00, 02, 0x1D, 00, 00, 0x09, 0x07}); + return true; } @@ -327,6 +330,15 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) { run_test("gateway"); } + if (command == "310") { + shell.printfln(F("Testing RC310...")); + run_test("310"); + shell.invoke_command("show devices"); + shell.invoke_command("show"); + shell.invoke_command("call system publish"); + shell.invoke_command("show mqtt"); + } + if (command == "web") { shell.printfln(F("Testing Web...")); @@ -916,6 +928,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) { shell.invoke_command("call system publish"); shell.invoke_command("show mqtt"); } + + if (command == "api") { + shell.printfln(F("Testing RESTful API...")); + // TODO add API + // AsyncWebServerRequest * request; + } } // simulates a telegram in the Rx queue, but without the CRC which is added automatically diff --git a/src/test/test.h b/src/test/test.h index 3d970f293..076bdfc1d 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -29,7 +29,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "thermostat" // #define EMSESP_DEBUG_DEFAULT "solar" // #define EMSESP_DEBUG_DEFAULT "mixer" -#define EMSESP_DEBUG_DEFAULT "web" +// #define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "general" // #define EMSESP_DEBUG_DEFAULT "boiler" // #define EMSESP_DEBUG_DEFAULT "mqtt2" @@ -37,6 +37,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "ha" // #define EMSESP_DEBUG_DEFAULT "board_profile" // #define EMSESP_DEBUG_DEFAULT "shower_alert" +#define EMSESP_DEBUG_DEFAULT "310" class Test { public: