Add optional token %id% to fulltopic

5.14.0a
* Add optional token %id% substituting the unique MAC address for topic
names by Michael Graf (#2794)
This commit is contained in:
Theo Arends 2018-05-21 17:52:24 +02:00
parent 0d838136e6
commit 4fbc51a874
3 changed files with 15 additions and 9 deletions

View File

@ -1,18 +1,20 @@
/* 5.14.0a
* Add feature information to Status 4
* Add tools folder with python script decode-status.py for decoding some status fields like SetOption and Features
* Add Eastron SDM630 energy meter (#2735)
* Add KNX communication enhancement (#2742)
* Add KNX energy data (#2750)
* Add python script fw-server.py in tools folder to create a simple OTA server (#2759)
* Add Eastron SDM630 energy meter by Gennaro Tortone (#2735)
* Add KNX communication enhancement by Adrian Scillato (#2742)
* Add KNX energy data by Adrian Scillato (#2750)
* Add python script fw-server.py in tools folder to create a simple OTA server by Gennaro Tortone (#2759)
* Add rules %mem1% to %mem5% variable names storing data in flash (#2780)
* Add rules test on %varx% or %memx% (#2780)
* Add optional token %id% substituting the unique MAC address for topic names by Michael Graf (#2794)
* Fix display selection of un-available GPIO options in Module Configuration webpage (#2718)
* Fix timer re-trigger within one minute after restart (#2744)
* Fix IRSend not accepting data value of 0 (#2751)
* Fix vars on rules (#2769)
* Fix bug in KNX menu (#2770)
* Fix IRSend not accepting data value of 0 by David Conran (#2751)
* Fix vars on rules by Adrian Scillato (#2769)
* Fix bug in KNX menu by Adrian Scillato (#2770)
* Fix anomalies in rules (#2778)
* Fix HUE bridge V1 software version by Heiko Krupp (#2788)
*
* 5.14.0 20180515
* Update language files
@ -27,13 +29,13 @@
* Fix KNX config error (#2628)
* Fix sensor MHZ-19 vanishing data over time (#2659)
* Fix KNX reconnection issue (#2679)
* Fix DST and STD time for Southern Hemisphere (#2684, #2714)
* Fix DST and STD time for Southern Hemisphere by Adrian Scillato (#2684, #2714)
* Add Portuguese in Brazil language file
* Add SetOption26 to enforce use of indexes even when only one relay is present (#1055)
* Add support for sensor SI1145 UV Index / IR / Visible light (#2496)
* Add rule state test for On/Off in addition to 0/1 (#2613)
* Add hardware serial option to MHZ-19 sensor (#2659)
* Add Eastron SDM120 energy meter (#2694)
* Add Eastron SDM120 energy meter by Gennaro Tortone (#2694)
* Add user entry DST/STD using commands TimeStd and TimeDst (See wiki for parameter syntax) (#2721)
*
* 5.13.1 20180501

View File

@ -55,6 +55,7 @@ typedef unsigned long power_t; // Power (Relay) type
#define MQTT_TOKEN_PREFIX "%prefix%" // To be substituted by mqtt_prefix[x]
#define MQTT_TOKEN_TOPIC "%topic%" // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic
#define MQTT_TOKEN_ID "%id%" // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic
#define WIFI_HOSTNAME "%s-%04d" // Expands to <MQTT_TOPIC>-<last 4 decimal chars of MAC address>

View File

@ -269,6 +269,9 @@ void GetTopic_P(char *stopic, byte prefix, char *topic, const char* subtopic)
}
fulltopic.replace(F(MQTT_TOKEN_PREFIX), Settings.mqtt_prefix[prefix]);
fulltopic.replace(F(MQTT_TOKEN_TOPIC), topic);
String token_id = WiFi.macAddress();
token_id.replace(":", "");
fulltopic.replace(F(MQTT_TOKEN_ID), token_id);
}
fulltopic.replace(F("#"), "");
fulltopic.replace(F("//"), "/");