fix display of mqtt subscriptions

This commit is contained in:
proddy
2021-10-20 09:34:50 +02:00
parent b3472c3919
commit fb7bafdb87
3 changed files with 8 additions and 5 deletions

View File

@@ -225,8 +225,10 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
for (const auto & mqtt_subfunction : mqtt_subfunctions_) { for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
shell.printfln(F(" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); shell.printfln(F(" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str());
} }
// now show the commands...
for (const auto & cf : Command::commands()) { for (const auto & cf : Command::commands()) {
if (subscribe_format_ == 2 && cf.has_flags(CommandFlag::MQTT_SUB_FLAG_HC)) { if (subscribe_format_ == Subscribe_Format::INDIVIDUAL_ALL_HC && cf.has_flags(CommandFlag::MQTT_SUB_FLAG_HC)) {
shell.printfln(F(" %s/%s/hc1/%s"), shell.printfln(F(" %s/%s/hc1/%s"),
mqtt_base_.c_str(), mqtt_base_.c_str(),
EMSdevice::device_type_2_device_name(cf.device_type_).c_str(), EMSdevice::device_type_2_device_name(cf.device_type_).c_str(),
@@ -243,7 +245,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
mqtt_base_.c_str(), mqtt_base_.c_str(),
EMSdevice::device_type_2_device_name(cf.device_type_).c_str(), EMSdevice::device_type_2_device_name(cf.device_type_).c_str(),
uuid::read_flash_string(cf.cmd_).c_str()); uuid::read_flash_string(cf.cmd_).c_str());
} else if (subscribe_format_ == 1 && !cf.has_flags(CommandFlag::MQTT_SUB_FLAG_NOSUB)) { } else if (subscribe_format_ != Subscribe_Format::GENERAL && !cf.has_flags(CommandFlag::MQTT_SUB_FLAG_NOSUB)) {
shell.printfln(F(" %s/%s/%s"), shell.printfln(F(" %s/%s/%s"),
mqtt_base_.c_str(), mqtt_base_.c_str(),
EMSdevice::device_type_2_device_name(cf.device_type_).c_str(), EMSdevice::device_type_2_device_name(cf.device_type_).c_str(),

View File

@@ -474,7 +474,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
if (command == "mqtt_individual") { if (command == "mqtt_individual") {
shell.printfln(F("Testing individual MQTT")); shell.printfln(F("Testing individual MQTT"));
Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter
Mqtt::subscribe_format(1); // individual topics Mqtt::subscribe_format(2); // individual topics, all HC
// Mqtt::subscribe_format(1); // individual topics, only main HC
run_test("boiler"); run_test("boiler");
run_test("thermostat"); run_test("thermostat");

View File

@@ -39,9 +39,9 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "shower_alert" // #define EMSESP_DEBUG_DEFAULT "shower_alert"
// #define EMSESP_DEBUG_DEFAULT "310" // #define EMSESP_DEBUG_DEFAULT "310"
// #define EMSESP_DEBUG_DEFAULT "render" // #define EMSESP_DEBUG_DEFAULT "render"
#define EMSESP_DEBUG_DEFAULT "api" // #define EMSESP_DEBUG_DEFAULT "api"
// #define EMSESP_DEBUG_DEFAULT "crash" // #define EMSESP_DEBUG_DEFAULT "crash"
// #define EMSESP_DEBUG_DEFAULT "mqtt_individual" #define EMSESP_DEBUG_DEFAULT "mqtt_individual"
class Test { class Test {
public: public: