fix: correctly retrieve and display IP address for both IPv4 and IPv6 configurations
This commit is contained in:
@@ -904,10 +904,22 @@ async fn try_connect_wifi_sntp_mqtt(
|
|||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let ip = match stack.config_v4() {
|
||||||
|
Some(config) => config.address.address().to_string(),
|
||||||
|
None => {
|
||||||
|
match stack.config_v6() {
|
||||||
|
Some(config) => config.address.address().to_string(),
|
||||||
|
None => {
|
||||||
|
String::from("No IP")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
NetworkMode::Wifi {
|
NetworkMode::Wifi {
|
||||||
sntp: sntp_mode,
|
sntp: sntp_mode,
|
||||||
mqtt: mqtt_connected,
|
mqtt: mqtt_connected,
|
||||||
ip_address: stack.hardware_address().to_string(),
|
ip_address: ip,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user