mirror of
https://github.com/esphome/esphome.git
synced 2025-10-01 17:42:22 +01:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -11,7 +11,7 @@ ci:
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.12.5
|
rev: v0.12.7
|
||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
|
@@ -283,6 +283,12 @@ bool WiFiComponent::wifi_sta_ip_config_(optional<ManualIP> manual_ip) {
|
|||||||
if (!this->wifi_mode_(true, {}))
|
if (!this->wifi_mode_(true, {}))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Check if the STA interface is initialized before using it
|
||||||
|
if (s_sta_netif == nullptr) {
|
||||||
|
ESP_LOGW(TAG, "STA interface not initialized");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
esp_netif_dhcp_status_t dhcp_status;
|
esp_netif_dhcp_status_t dhcp_status;
|
||||||
esp_err_t err = esp_netif_dhcpc_get_status(s_sta_netif, &dhcp_status);
|
esp_err_t err = esp_netif_dhcpc_get_status(s_sta_netif, &dhcp_status);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
@@ -541,6 +547,8 @@ void WiFiComponent::wifi_event_callback_(esphome_wifi_event_id_t event, esphome_
|
|||||||
}
|
}
|
||||||
case ESPHOME_EVENT_ID_WIFI_STA_STOP: {
|
case ESPHOME_EVENT_ID_WIFI_STA_STOP: {
|
||||||
ESP_LOGV(TAG, "STA stop");
|
ESP_LOGV(TAG, "STA stop");
|
||||||
|
// Clear the STA interface handle to prevent use-after-free
|
||||||
|
s_sta_netif = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESPHOME_EVENT_ID_WIFI_STA_CONNECTED: {
|
case ESPHOME_EVENT_ID_WIFI_STA_CONNECTED: {
|
||||||
@@ -630,6 +638,10 @@ void WiFiComponent::wifi_event_callback_(esphome_wifi_event_id_t event, esphome_
|
|||||||
}
|
}
|
||||||
case ESPHOME_EVENT_ID_WIFI_AP_STOP: {
|
case ESPHOME_EVENT_ID_WIFI_AP_STOP: {
|
||||||
ESP_LOGV(TAG, "AP stop");
|
ESP_LOGV(TAG, "AP stop");
|
||||||
|
#ifdef USE_WIFI_AP
|
||||||
|
// Clear the AP interface handle to prevent use-after-free
|
||||||
|
s_ap_netif = nullptr;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESPHOME_EVENT_ID_WIFI_AP_STACONNECTED: {
|
case ESPHOME_EVENT_ID_WIFI_AP_STACONNECTED: {
|
||||||
@@ -719,6 +731,12 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||||||
if (!this->wifi_mode_({}, true))
|
if (!this->wifi_mode_({}, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Check if the AP interface is initialized before using it
|
||||||
|
if (s_ap_netif == nullptr) {
|
||||||
|
ESP_LOGW(TAG, "AP interface not initialized");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
esp_netif_ip_info_t info;
|
esp_netif_ip_info_t info;
|
||||||
if (manual_ip.has_value()) {
|
if (manual_ip.has_value()) {
|
||||||
info.ip = manual_ip->static_ip;
|
info.ip = manual_ip->static_ip;
|
||||||
|
@@ -473,6 +473,12 @@ bool WiFiComponent::wifi_sta_ip_config_(optional<ManualIP> manual_ip) {
|
|||||||
if (!this->wifi_mode_(true, {}))
|
if (!this->wifi_mode_(true, {}))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Check if the STA interface is initialized before using it
|
||||||
|
if (s_sta_netif == nullptr) {
|
||||||
|
ESP_LOGW(TAG, "STA interface not initialized");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
esp_netif_dhcp_status_t dhcp_status;
|
esp_netif_dhcp_status_t dhcp_status;
|
||||||
esp_err_t err = esp_netif_dhcpc_get_status(s_sta_netif, &dhcp_status);
|
esp_err_t err = esp_netif_dhcpc_get_status(s_sta_netif, &dhcp_status);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
@@ -691,6 +697,8 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) {
|
|||||||
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_STA_STOP) {
|
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_STA_STOP) {
|
||||||
ESP_LOGV(TAG, "STA stop");
|
ESP_LOGV(TAG, "STA stop");
|
||||||
s_sta_started = false;
|
s_sta_started = false;
|
||||||
|
// Clear the STA interface handle to prevent use-after-free
|
||||||
|
s_sta_netif = nullptr;
|
||||||
|
|
||||||
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_STA_AUTHMODE_CHANGE) {
|
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_STA_AUTHMODE_CHANGE) {
|
||||||
const auto &it = data->data.sta_authmode_change;
|
const auto &it = data->data.sta_authmode_change;
|
||||||
@@ -789,6 +797,10 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) {
|
|||||||
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_AP_STOP) {
|
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_AP_STOP) {
|
||||||
ESP_LOGV(TAG, "AP stop");
|
ESP_LOGV(TAG, "AP stop");
|
||||||
s_ap_started = false;
|
s_ap_started = false;
|
||||||
|
#ifdef USE_WIFI_AP
|
||||||
|
// Clear the AP interface handle to prevent use-after-free
|
||||||
|
s_ap_netif = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_AP_PROBEREQRECVED) {
|
} else if (data->event_base == WIFI_EVENT && data->event_id == WIFI_EVENT_AP_PROBEREQRECVED) {
|
||||||
const auto &it = data->data.ap_probe_req_rx;
|
const auto &it = data->data.ap_probe_req_rx;
|
||||||
@@ -865,6 +877,12 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
|||||||
if (!this->wifi_mode_({}, true))
|
if (!this->wifi_mode_({}, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Check if the AP interface is initialized before using it
|
||||||
|
if (s_ap_netif == nullptr) {
|
||||||
|
ESP_LOGW(TAG, "AP interface not initialized");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
esp_netif_ip_info_t info;
|
esp_netif_ip_info_t info;
|
||||||
if (manual_ip.has_value()) {
|
if (manual_ip.has_value()) {
|
||||||
info.ip = manual_ip->static_ip;
|
info.ip = manual_ip->static_ip;
|
||||||
|
@@ -12,7 +12,7 @@ platformio==6.1.18 # When updating platformio, also update /docker/Dockerfile
|
|||||||
esptool==4.9.0
|
esptool==4.9.0
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
esphome-dashboard==20250514.0
|
esphome-dashboard==20250514.0
|
||||||
aioesphomeapi==37.1.4
|
aioesphomeapi==37.1.5
|
||||||
zeroconf==0.147.0
|
zeroconf==0.147.0
|
||||||
puremagic==1.30
|
puremagic==1.30
|
||||||
ruamel.yaml==0.18.14 # dashboard_import
|
ruamel.yaml==0.18.14 # dashboard_import
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
pylint==3.3.7
|
pylint==3.3.7
|
||||||
flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
|
flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
|
||||||
ruff==0.12.5 # also change in .pre-commit-config.yaml when updating
|
ruff==0.12.7 # also change in .pre-commit-config.yaml when updating
|
||||||
pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating
|
pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating
|
||||||
pre-commit
|
pre-commit
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user