fix: only create mqtt subs for Boiler (expose individual commands via MQTT topics #31)

This commit is contained in:
proddy
2021-03-21 17:31:52 +01:00
parent 4db69760c6
commit b9c08a58ad
8 changed files with 180 additions and 173 deletions

View File

@@ -108,9 +108,12 @@ void Mqtt::register_command(const uint8_t device_type, const __FlashStringHelper
// register the individual commands too (e.g. ems-esp/boiler/wwonetime)
// https://github.com/emsesp/EMS-ESP32/issues/31
std::string topic(100, '\0');
topic = cmd_topic + "/" + uuid::read_flash_string(cmd);
Mqtt::subscribe(device_type, topic, nullptr);
// for now only do this for the boiler
if (device_type == EMSdevice::DeviceType::BOILER) {
std::string topic(100, '\0');
topic = cmd_topic + "/" + uuid::read_flash_string(cmd);
Mqtt::subscribe(device_type, topic, nullptr);
}
}
// subscribe to an MQTT topic, and store the associated callback function