mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 13:16:45 +00:00
Remove halGetMacAddress() calls
This commit is contained in:
parent
3e0ca0241f
commit
73b6dd2e2f
@ -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\","),
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user