mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 16:47:57 +01:00
Add platform and board to mdns response when API is used (#1871)
This commit is contained in:
parent
5cf18235e3
commit
65c50e4f01
@ -349,6 +349,7 @@ async def to_code(config):
|
||||
if config[CONF_INCLUDES]:
|
||||
CORE.add_job(add_includes, config[CONF_INCLUDES])
|
||||
|
||||
cg.add_define("ESPHOME_BOARD", CORE.board)
|
||||
if CONF_PROJECT in config:
|
||||
cg.add_define("ESPHOME_PROJECT_NAME", config[CONF_PROJECT][CONF_NAME])
|
||||
cg.add_define("ESPHOME_PROJECT_VERSION", config[CONF_PROJECT][CONF_VERSION])
|
||||
|
@ -24,3 +24,5 @@
|
||||
#define USE_TIME
|
||||
#define USE_DEEP_SLEEP
|
||||
#define USE_CAPTIVE_PORTAL
|
||||
#define ESPHOME_BOARD "dummy_board"
|
||||
#define USE_MDNS
|
||||
|
@ -94,7 +94,13 @@ void network_setup_mdns(IPAddress address, int interface) {
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "version", ESPHOME_VERSION);
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "address", network_get_address().c_str());
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "mac", get_mac_address().c_str());
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "platform", "ESP8266");
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "platform", "ESP32");
|
||||
#endif
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "board", ESPHOME_BOARD);
|
||||
#ifdef ESPHOME_PROJECT_NAME
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "project_name", ESPHOME_PROJECT_NAME);
|
||||
MDNS.addServiceTxt("esphomelib", "tcp", "project_version", ESPHOME_PROJECT_VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user