diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index 54e706d1..7f8d6125 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -1153,8 +1153,8 @@ void dispatch_statusupdate(const char*, const char*, uint8_t source) network_get_statusupdate(buffer, sizeof(buffer)); strcat(data, buffer); - snprintf_P(buffer, sizeof(buffer), PSTR("\"mac\":\"%s\","), halGetMacAddress(0, ":").c_str()); - strcat(data, buffer); + // snprintf_P(buffer, sizeof(buffer), PSTR("\"mac\":\"%s\","), halGetMacAddress(0, ":").c_str()); + // strcat(data, buffer); #endif snprintf_P(buffer, sizeof(buffer), PSTR("\"heapFree\":%u,\"heapFrag\":%u,\"core\":\"%s\","), diff --git a/src/mqtt/hasp_mqtt_ha.cpp b/src/mqtt/hasp_mqtt_ha.cpp index 91de21cf..bf6edb1c 100644 --- a/src/mqtt/hasp_mqtt_ha.cpp +++ b/src/mqtt/hasp_mqtt_ha.cpp @@ -78,7 +78,7 @@ void mqtt_ha_add_device_ids(JsonDocument& doc) JsonObject device = doc.createNestedObject(FPSTR(FP_MQTT_HA_DEVICE)); JsonArray ids = device.createNestedArray(FPSTR(FP_MQTT_HA_IDENTIFIERS)); ids.add(haspDevice.get_hostname()); - ids.add(HASP_MAC_ADDRESS_STR); + ids.add(haspDevice.get_hardware_id()); device[F("sw")] = haspDevice.get_version(); device[FPSTR(FP_MQTT_HA_NAME)] = haspDevice.get_hostname(); @@ -96,7 +96,7 @@ void mqtt_ha_add_unique_id(JsonDocument& doc, char* item) snprintf_P(buffer, sizeof(buffer), PSTR("%s %s"), haspDevice.get_hostname(), item); doc[FPSTR(FP_MQTT_HA_NAME)] = buffer; - snprintf_P(buffer, sizeof(buffer), PSTR("hasp_%s-%s"), HASP_MAC_ADDRESS, item); + snprintf_P(buffer, sizeof(buffer), PSTR("hasp_%s-%s"), haspDevice.get_hostname(), item); doc[F("uniq_id")] = buffer; } diff --git a/src/sys/net/hasp_ethernet_esp32.cpp b/src/sys/net/hasp_ethernet_esp32.cpp index 4b4c64c4..3b872d9d 100644 --- a/src/sys/net/hasp_ethernet_esp32.cpp +++ b/src/sys/net/hasp_ethernet_esp32.cpp @@ -66,8 +66,9 @@ bool ethernetEvery5Seconds() void ethernet_get_statusupdate(char* buffer, size_t len) { - snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":\"%d Mbps\",\"ip\":\"%s\","), - eth_connected ? F("on") : F("off"), ETH.linkSpeed(), ETH.localIP().toString().c_str()); + snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":\"%d Mbps\",\"ip\":\"%s\",\"mac\":\"%s\","), + eth_connected ? F("on") : F("off"), ETH.linkSpeed(), ETH.localIP().toString().c_str(), + ETH.macAddress().c_str()); } void ethernet_get_info(JsonDocument& doc) diff --git a/src/sys/net/hasp_ethernet_stm32.cpp b/src/sys/net/hasp_ethernet_stm32.cpp index 0bfb6de1..6923cba4 100644 --- a/src/sys/net/hasp_ethernet_stm32.cpp +++ b/src/sys/net/hasp_ethernet_stm32.cpp @@ -25,7 +25,7 @@ void ethernetSetup() eth_connected = true; } - LOG_TRACE(TAG_ETH, F("MAC Address %s"), halGetMacAddress(0, ":")); + LOG_TRACE(TAG_ETH, F("MAC Address %s"), Ethernet.macAddress().c_str()); #else byte mac[6]; diff --git a/src/sys/net/hasp_wifi.cpp b/src/sys/net/hasp_wifi.cpp index c9e2f14c..60d647a6 100644 --- a/src/sys/net/hasp_wifi.cpp +++ b/src/sys/net/hasp_wifi.cpp @@ -558,12 +558,12 @@ void wifi_get_statusupdate(char* buffer, size_t len) ip = WiFi.localIP(); char espIp[16]; memset(espIp, 0, sizeof(espIp)); - snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%d.%d.%d.%d\","), WiFi.SSID(), WiFi.RSSI(), - ip[0], ip[1], ip[2], ip[3]); + snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%d.%d.%d.%d\",\"mac\":\"%s\","), WiFi.SSID(), + WiFi.RSSI(), ip[0], ip[1], ip[2], ip[3], "TODO"); #else strncpy(wifiIpAddress, WiFi.localIP().toString().c_str(), sizeof(wifiIpAddress)); - snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%s\","), WiFi.SSID().c_str(), WiFi.RSSI(), - wifiIpAddress); + snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%s\",\"mac\":\"%s\","), WiFi.SSID().c_str(), + WiFi.RSSI(), wifiIpAddress, WiFi.macAddress().c_str()); #endif }