mirror of https://github.com/arendst/Tasmota.git
Add support for full MAC address
Add support for unique MQTTClient (and inherited fallback topic) by full Mac address using ``mqttclient DVES_%12X`` (#8300)
This commit is contained in:
parent
12391c30a7
commit
66233b1749
|
@ -62,6 +62,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||
- Add command ``Rule0`` to change global rule parameters
|
||||
- Add command ``Time 4`` to display timestamp using milliseconds (#8537)
|
||||
- Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491)
|
||||
- Add support for unique MQTTClient (and inherited fallback topic) by full Mac address using ``mqttclient DVES_%12X`` (#8300)
|
||||
- Add more functionality to ``Switchmode`` 11 and 12 (#8450)
|
||||
- Add wildcard pattern ``?`` for JSON matching in rules
|
||||
- Add support for VEML6075 UVA/UVB/UVINDEX Sensor by device111 (#8432)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
- Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491)
|
||||
- Add Three Phase Export Active Energy to SDM630 driver
|
||||
- Add wildcard pattern ``?`` for JSON matching in rules
|
||||
- Add support for unique MQTTClient (and inherited fallback topic) by full Mac address using ``mqttclient DVES_%12X`` (#8300)
|
||||
|
||||
### 8.3.1.1 20200518
|
||||
|
||||
|
|
|
@ -118,12 +118,12 @@
|
|||
#define PUB_PREFIX2 "tele" // [Prefix3] Tasmota devices publish telemetry data to %prefix%/%topic% being PUB_PREFIX2/MQTT_TOPIC/UPTIME, POWER and TIME
|
||||
// May be named the same as PUB_PREFIX
|
||||
// %topic% token options (also ButtonTopic and SwitchTopic)
|
||||
#define MQTT_TOPIC PROJECT "_%06X" // [Topic] unique MQTT device topic including device MAC address
|
||||
#define MQTT_TOPIC PROJECT "_%06X" // [Topic] unique MQTT device topic including (part of) device MAC address
|
||||
#define MQTT_GRPTOPIC "tasmotas" // [GroupTopic] MQTT Group topic
|
||||
#define MQTT_GROUPTOPIC_FORMAT false // [SetOption75] GroupTopic replaces %topic% (false) or fixed topic cmnd/grouptopic (true)
|
||||
#define MQTT_BUTTON_TOPIC "0" // [ButtonTopic] MQTT button topic, "0" = same as MQTT_TOPIC, set to 'PROJECT "_BTN_%06X"' for unique topic including device MAC address
|
||||
#define MQTT_SWITCH_TOPIC "0" // [SwitchTopic] MQTT button topic, "0" = same as MQTT_TOPIC, set to 'PROJECT "_SW_%06X"' for unique topic including device MAC address
|
||||
#define MQTT_CLIENT_ID "DVES_%06X" // [MqttClient] Also fall back topic using Chip Id = last 6 characters of MAC address
|
||||
#define MQTT_CLIENT_ID "DVES_%06X" // [MqttClient] Also fall back topic using last 6 characters of MAC address or use "DVES_%12X" for complete MAC address
|
||||
|
||||
// -- MQTT - Telemetry ----------------------------
|
||||
#define TELE_PERIOD 300 // [TelePeriod] Telemetry (0 = disable, 10 - 3600 seconds)
|
||||
|
@ -648,7 +648,7 @@
|
|||
#define USE_ZIGBEE_CHANNEL 11 // Zigbee Channel (11-26)
|
||||
#define USE_ZIGBEE_PRECFGKEY_L 0x0F0D0B0907050301L // note: changing requires to re-pair all devices
|
||||
#define USE_ZIGBEE_PRECFGKEY_H 0x0D0C0A0806040200L // note: changing requires to re-pair all devices
|
||||
|
||||
|
||||
#define USE_ZIGBEE_COALESCE_ATTR_TIMER 350 // timer to coalesce attribute values (in ms)
|
||||
|
||||
// -- Other sensors/drivers -----------------------
|
||||
|
|
|
@ -41,12 +41,15 @@ char* Format(char* output, const char* input, int size)
|
|||
snprintf_P(tmp, size, PSTR("%s%c0%dd"), output, '%', digits);
|
||||
snprintf_P(output, size, tmp, ESP_getChipId() & 0x1fff); // %04d - short chip ID in dec, like in hostname
|
||||
} else {
|
||||
snprintf_P(tmp, size, PSTR("%s%c0%dX"), output, '%', digits);
|
||||
snprintf_P(output, size, tmp, ESP_getChipId()); // %06X - full chip ID in hex
|
||||
String mac_address = WiFi.macAddress();
|
||||
mac_address.replace(":", "");
|
||||
if (digits > 12) { digits = 12; }
|
||||
String mac_part = mac_address.substring(12 - digits);
|
||||
snprintf_P(output, size, PSTR("%s%s"), output, mac_part.c_str()); // %01X .. %12X - mac address in hex
|
||||
}
|
||||
} else {
|
||||
if (strchr(token, 'd')) {
|
||||
snprintf_P(output, size, PSTR("%s%d"), output, ESP_getChipId()); // %d - full chip ID in dec
|
||||
snprintf_P(output, size, PSTR("%s%d"), output, ESP_getChipId()); // %d - full chip ID in dec
|
||||
digits = 8;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue