mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 21:26:43 +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));
|
network_get_statusupdate(buffer, sizeof(buffer));
|
||||||
strcat(data, buffer);
|
strcat(data, buffer);
|
||||||
|
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("\"mac\":\"%s\","), halGetMacAddress(0, ":").c_str());
|
// snprintf_P(buffer, sizeof(buffer), PSTR("\"mac\":\"%s\","), halGetMacAddress(0, ":").c_str());
|
||||||
strcat(data, buffer);
|
// strcat(data, buffer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("\"heapFree\":%u,\"heapFrag\":%u,\"core\":\"%s\","),
|
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));
|
JsonObject device = doc.createNestedObject(FPSTR(FP_MQTT_HA_DEVICE));
|
||||||
JsonArray ids = device.createNestedArray(FPSTR(FP_MQTT_HA_IDENTIFIERS));
|
JsonArray ids = device.createNestedArray(FPSTR(FP_MQTT_HA_IDENTIFIERS));
|
||||||
ids.add(haspDevice.get_hostname());
|
ids.add(haspDevice.get_hostname());
|
||||||
ids.add(HASP_MAC_ADDRESS_STR);
|
ids.add(haspDevice.get_hardware_id());
|
||||||
|
|
||||||
device[F("sw")] = haspDevice.get_version();
|
device[F("sw")] = haspDevice.get_version();
|
||||||
device[FPSTR(FP_MQTT_HA_NAME)] = haspDevice.get_hostname();
|
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);
|
snprintf_P(buffer, sizeof(buffer), PSTR("%s %s"), haspDevice.get_hostname(), item);
|
||||||
doc[FPSTR(FP_MQTT_HA_NAME)] = buffer;
|
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;
|
doc[F("uniq_id")] = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,9 @@ bool ethernetEvery5Seconds()
|
|||||||
|
|
||||||
void ethernet_get_statusupdate(char* buffer, size_t len)
|
void ethernet_get_statusupdate(char* buffer, size_t len)
|
||||||
{
|
{
|
||||||
snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":\"%d Mbps\",\"ip\":\"%s\","),
|
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_connected ? F("on") : F("off"), ETH.linkSpeed(), ETH.localIP().toString().c_str(),
|
||||||
|
ETH.macAddress().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ethernet_get_info(JsonDocument& doc)
|
void ethernet_get_info(JsonDocument& doc)
|
||||||
|
@ -25,7 +25,7 @@ void ethernetSetup()
|
|||||||
eth_connected = true;
|
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
|
#else
|
||||||
byte mac[6];
|
byte mac[6];
|
||||||
|
@ -558,12 +558,12 @@ void wifi_get_statusupdate(char* buffer, size_t len)
|
|||||||
ip = WiFi.localIP();
|
ip = WiFi.localIP();
|
||||||
char espIp[16];
|
char espIp[16];
|
||||||
memset(espIp, 0, sizeof(espIp));
|
memset(espIp, 0, sizeof(espIp));
|
||||||
snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%d.%d.%d.%d\","), WiFi.SSID(), WiFi.RSSI(),
|
snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%d.%d.%d.%d\",\"mac\":\"%s\","), WiFi.SSID(),
|
||||||
ip[0], ip[1], ip[2], ip[3]);
|
WiFi.RSSI(), ip[0], ip[1], ip[2], ip[3], "TODO");
|
||||||
#else
|
#else
|
||||||
strncpy(wifiIpAddress, WiFi.localIP().toString().c_str(), sizeof(wifiIpAddress));
|
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(),
|
snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%s\",\"mac\":\"%s\","), WiFi.SSID().c_str(),
|
||||||
wifiIpAddress);
|
WiFi.RSSI(), wifiIpAddress, WiFi.macAddress().c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user