Browse Source

Added {magnitude} placeholder

softuart
Xose Pérez 6 years ago
parent
commit
55ddae8a16
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      code/espurna/mqtt.ino

+ 2
- 1
code/espurna/mqtt.ino View File

@ -215,11 +215,12 @@ void _mqttConfigure() {
// Get base topic // Get base topic
_mqtt_topic = getSetting("mqttTopic", MQTT_TOPIC); _mqtt_topic = getSetting("mqttTopic", MQTT_TOPIC);
if (_mqtt_topic.endsWith("/")) _mqtt_topic.remove(_mqtt_topic.length()-1); if (_mqtt_topic.endsWith("/")) _mqtt_topic.remove(_mqtt_topic.length()-1);
if (_mqtt_topic.indexOf("#") == -1) _mqtt_topic = _mqtt_topic + "/#";
// Placeholders // Placeholders
_mqtt_topic.replace("{identifier}", getSetting("hostname")); _mqtt_topic.replace("{identifier}", getSetting("hostname"));
_mqtt_topic.replace("{hostname}", getSetting("hostname")); _mqtt_topic.replace("{hostname}", getSetting("hostname"));
_mqtt_topic.replace("{magnitude}", "#");
if (_mqtt_topic.indexOf("#") == -1) _mqtt_topic = _mqtt_topic + "/#";
String mac = WiFi.macAddress(); String mac = WiFi.macAddress();
mac.replace(":", ""); mac.replace(":", "");
_mqtt_topic.replace("{mac}", mac); _mqtt_topic.replace("{mac}", mac);


Loading…
Cancel
Save