Skip to content

Commit

Permalink
put/# back - Refactor MQTT subscriptions and API calls #173
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Nov 3, 2021
1 parent af27101 commit 7a079d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
F_(entities_cmd));

// MQTT subscribe to the device top-level, e.g. "ems-esp/boiler" and subs
std::string topic = EMSdevice::device_type_2_device_name(device_type) + "#";
std::string topic = EMSdevice::device_type_2_device_name(device_type) + "/#";
Mqtt::subscribe(device_type, topic, nullptr); // use empty function callback

// Print to LOG showing we've added a new device
Expand Down
5 changes: 3 additions & 2 deletions src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,9 @@ void System::commands_init() {
Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, F("run tests"));
#endif

// MQTT subscribe "ems-esp/system" and subs
Mqtt::subscribe(EMSdevice::DeviceType::SYSTEM, "system#", nullptr); // use empty function callback
// MQTT subscribe "ems-esp/system/#"
// There is no need to subscribe only to 'ems-esp/system' as the commands send and pin require the fullpath for security
Mqtt::subscribe(EMSdevice::DeviceType::SYSTEM, "system/#", nullptr); // use empty function callback
}

// flashes the LED
Expand Down

0 comments on commit 7a079d8

Please sign in to comment.