Browse Source

Moved {identifier} check to _mqttBackwards

rfm69
Xose Pérez 6 years ago
parent
commit
36f6d399bd
2 changed files with 11 additions and 10 deletions
  1. +1
    -10
      code/espurna/migrate.ino
  2. +10
    -0
      code/espurna/mqtt.ino

+ 1
- 10
code/espurna/migrate.ino View File

@ -962,7 +962,7 @@ void migrate() {
setSetting("btnRelay", 0, 0);
setSetting("relayGPIO", 0, 12);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(PILOTAK_ESP_DIN_V1)
setSetting("board", 76);
@ -1013,15 +1013,6 @@ void migrate() {
}
#if MQTT_SUPPORT
// Deprecated MQTT substitution
String mqttTopic = getSetting("mqttTopic", MQTT_TOPIC);
if (mqttTopic.indexOf("{identifier}") > 0) {
mqttTopic.replace("{identifier}", "{hostname}");
setSetting("mqttTopic", mqttTopic);
}
#endif
saveSettings();
}

+ 10
- 0
code/espurna/mqtt.ino View File

@ -249,6 +249,14 @@ void _mqttConfigure() {
}
void _mqttBackwards() {
String mqttTopic = getSetting("mqttTopic", MQTT_TOPIC);
if (mqttTopic.indexOf("{identifier}") > 0) {
mqttTopic.replace("{identifier}", "{hostname}");
setSetting("mqttTopic", mqttTopic);
}
}
unsigned long _mqttNextMessageId() {
static unsigned long id = 0;
@ -740,6 +748,8 @@ void mqttReset() {
void mqttSetup() {
_mqttBackwards();
DEBUG_MSG_P(PSTR("[MQTT] Async %s, SSL %s, Autoconnect %s\n"),
MQTT_USE_ASYNC ? "ENABLED" : "DISABLED",
ASYNC_TCP_SSL_ENABLED ? "ENABLED" : "DISABLED",


Loading…
Cancel
Save