Skip to content

Commit

Permalink
add test for Dan "ems-esp/boiler/wwcircpump with payload off"
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Oct 19, 2021
1 parent aad4b0a commit 7f3ff43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,20 @@ class Mqtt {
return ha_climate_format_;
}

// nested_format is 1 if nested, otherwise 2 for single topics
static uint8_t nested_format() {
return nested_format_; // nested_format is 1 if nested, otherwise 2 for single topics
return nested_format_;
}

static void nested_format(uint8_t nested_format) {
nested_format_ = nested_format; // nested_format is 1 if nested, otherwise 2 for single topics
nested_format_ = nested_format;
}

// subscribe_format is 0 for General topics, 1 for individual with main heating circuit or 2 for individual topics with all heating circuits
static uint8_t subscribe_format() {
return subscribe_format_;
}
static void subscribe_format(uint8_t subscribe_format) {
subscribe_format_ = subscribe_format;
}

static bool ha_enabled() {
Expand Down
12 changes: 12 additions & 0 deletions src/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,18 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
shell.invoke_command("call boiler entities");
}

if (command == "mqtt_individual") {
shell.printfln(F("Testing individual MQTT"));
Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter
Mqtt::subscribe_format(1); // individual topics

run_test("boiler");
run_test("thermostat");

shell.invoke_command("show mqtt");
EMSESP::mqtt_.incoming("ems-esp/boiler/wwcircpump", "off");
}

if (command == "mqtt_nested") {
shell.printfln(F("Testing nested MQTT"));
Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter
Expand Down
3 changes: 2 additions & 1 deletion src/test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "general"
// #define EMSESP_DEBUG_DEFAULT "boiler"
// #define EMSESP_DEBUG_DEFAULT "mqtt2"
#define EMSESP_DEBUG_DEFAULT "mqtt_nested"
// #define EMSESP_DEBUG_DEFAULT "mqtt_nested"
// #define EMSESP_DEBUG_DEFAULT "ha"
// #define EMSESP_DEBUG_DEFAULT "board_profile"
// #define EMSESP_DEBUG_DEFAULT "shower_alert"
// #define EMSESP_DEBUG_DEFAULT "310"
// #define EMSESP_DEBUG_DEFAULT "render"
// #define EMSESP_DEBUG_DEFAULT "api"
// #define EMSESP_DEBUG_DEFAULT "crash"
#define EMSESP_DEBUG_DEFAULT "mqtt_individual"

class Test {
public:
Expand Down

0 comments on commit 7f3ff43

Please sign in to comment.