Don't include mac address code when not prebuilt
This commit is contained in:
@@ -1706,19 +1706,19 @@ text_sensor:
|
||||
internal: false
|
||||
disabled_by_default: false
|
||||
lambda: |-
|
||||
if (!${pre_built}) {
|
||||
return {"${name}"};
|
||||
} else {
|
||||
std::string suffix;
|
||||
uint8_t mac[6] = {0,0,0,0,0,0};
|
||||
esp_read_mac(mac, ESP_MAC_WIFI_STA);
|
||||
for (int i = 3; i < 6; ++i) {
|
||||
char hex[3];
|
||||
snprintf(hex, sizeof(hex), "%02X", mac[i]);
|
||||
suffix += hex;
|
||||
}
|
||||
return {"${name}" + "-" + suffix};
|
||||
}
|
||||
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT
|
||||
std::string suffix;
|
||||
uint8_t mac[6] = {0,0,0,0,0,0};
|
||||
esp_read_mac(mac, ESP_MAC_WIFI_STA);
|
||||
for (int i = 3; i < 6; ++i) {
|
||||
char hex[3];
|
||||
snprintf(hex, sizeof(hex), "%02X", mac[i]);
|
||||
suffix += hex;
|
||||
}
|
||||
return {"${name}" + "-" + suffix};
|
||||
#else
|
||||
return {"${name}"};
|
||||
#endif
|
||||
filters:
|
||||
- lambda: |-
|
||||
std::string result;
|
||||
|
||||
Reference in New Issue
Block a user