mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
127e5c2e7f
1692 changed files with 116 additions and 37 deletions
|
@ -694,15 +694,15 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
info.netmask = network::IPAddress(255, 255, 255, 0);
|
info.netmask = network::IPAddress(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_dhcpc_stop(s_ap_netif);
|
err = esp_netif_dhcps_stop(s_ap_netif);
|
||||||
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcpc_stop failed: %s", esp_err_to_name(err));
|
ESP_LOGE(TAG, "esp_netif_dhcps_stop failed: %s", esp_err_to_name(err));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_set_ip_info failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,20 +712,20 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
start_address += 99;
|
start_address += 99;
|
||||||
lease.start_ip = start_address;
|
lease.start_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||||
start_address += 100;
|
start_address += 10;
|
||||||
lease.end_ip = start_address;
|
lease.end_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||||
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
||||||
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcps_option failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_dhcps_start(s_ap_netif);
|
err = esp_netif_dhcps_start(s_ap_netif);
|
||||||
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcps_start failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -716,12 +716,12 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
|
|
||||||
if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
||||||
if (!wifi_softap_dhcps_stop()) {
|
if (!wifi_softap_dhcps_stop()) {
|
||||||
ESP_LOGV(TAG, "Stopping DHCP server failed!");
|
ESP_LOGW(TAG, "Stopping DHCP server failed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wifi_set_ip_info(SOFTAP_IF, &info)) {
|
if (!wifi_set_ip_info(SOFTAP_IF, &info)) {
|
||||||
ESP_LOGV(TAG, "Setting SoftAP info failed!");
|
ESP_LOGE(TAG, "Setting SoftAP info failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,17 +735,17 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
start_address += 99;
|
start_address += 99;
|
||||||
lease.start_ip = start_address;
|
lease.start_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||||
start_address += 100;
|
start_address += 10;
|
||||||
lease.end_ip = start_address;
|
lease.end_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||||
if (!wifi_softap_set_dhcps_lease(&lease)) {
|
if (!wifi_softap_set_dhcps_lease(&lease)) {
|
||||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease failed!");
|
ESP_LOGE(TAG, "Setting SoftAP DHCP lease failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// lease time 1440 minutes (=24 hours)
|
// lease time 1440 minutes (=24 hours)
|
||||||
if (!wifi_softap_set_dhcps_lease_time(1440)) {
|
if (!wifi_softap_set_dhcps_lease_time(1440)) {
|
||||||
ESP_LOGV(TAG, "Setting SoftAP DHCP lease time failed!");
|
ESP_LOGE(TAG, "Setting SoftAP DHCP lease time failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,13 +755,13 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
uint8_t mode = 1;
|
uint8_t mode = 1;
|
||||||
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
|
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
|
||||||
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
|
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
|
||||||
ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
ESP_LOGE(TAG, "wifi_softap_set_dhcps_offer_option failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!wifi_softap_dhcps_start()) {
|
if (!wifi_softap_dhcps_start()) {
|
||||||
ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!");
|
ESP_LOGE(TAG, "Starting SoftAP DHCPS failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -823,15 +823,15 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
info.netmask = network::IPAddress(255, 255, 255, 0);
|
info.netmask = network::IPAddress(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_dhcpc_stop(s_ap_netif);
|
err = esp_netif_dhcps_stop(s_ap_netif);
|
||||||
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcpc_stop failed: %s", esp_err_to_name(err));
|
ESP_LOGE(TAG, "esp_netif_dhcps_stop failed: %s", esp_err_to_name(err));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
err = esp_netif_set_ip_info(s_ap_netif, &info);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_set_ip_info failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_set_ip_info failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,20 +841,20 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
|
||||||
start_address += 99;
|
start_address += 99;
|
||||||
lease.start_ip = start_address;
|
lease.start_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease start: %s", start_address.str().c_str());
|
||||||
start_address += 100;
|
start_address += 10;
|
||||||
lease.end_ip = start_address;
|
lease.end_ip = start_address;
|
||||||
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
ESP_LOGV(TAG, "DHCP server IP lease end: %s", start_address.str().c_str());
|
||||||
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(lease));
|
||||||
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcps_option failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_dhcps_option failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esp_netif_dhcps_start(s_ap_netif);
|
err = esp_netif_dhcps_start(s_ap_netif);
|
||||||
|
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_netif_dhcps_start failed! %d", err);
|
ESP_LOGE(TAG, "esp_netif_dhcps_start failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,12 +887,12 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
|
||||||
|
|
||||||
esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &conf);
|
esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &conf);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGV(TAG, "esp_wifi_set_config failed! %d", err);
|
ESP_LOGE(TAG, "esp_wifi_set_config failed! %d", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->wifi_ap_ip_config_(ap.get_manual_ip())) {
|
if (!this->wifi_ap_ip_config_(ap.get_manual_ip())) {
|
||||||
ESP_LOGV(TAG, "wifi_ap_ip_config_ failed!");
|
ESP_LOGE(TAG, "wifi_ap_ip_config_ failed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ fi
|
||||||
|
|
||||||
start_esphome() {
|
start_esphome() {
|
||||||
# create dynamic yaml file in `build` folder.
|
# create dynamic yaml file in `build` folder.
|
||||||
# `./tests/test_build_components/build/[target_component].[test_name].[target_platform].yaml`
|
# `./tests/test_build_components/build/[target_component].[test_name].[target_platform_with_version].yaml`
|
||||||
component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform.yaml"
|
component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform_with_version.yaml"
|
||||||
|
|
||||||
cp $target_platform_file $component_test_file
|
cp $target_platform_file $component_test_file
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
@ -36,7 +36,7 @@ start_esphome() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start esphome process
|
# Start esphome process
|
||||||
echo "> [$target_component] [$test_name] [$target_platform]"
|
echo "> [$target_component] [$test_name] [$target_platform_with_version]"
|
||||||
set -x
|
set -x
|
||||||
# TODO: Validate escape of Command line substitution value
|
# TODO: Validate escape of Command line substitution value
|
||||||
python -m esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
|
python -m esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
|
||||||
|
@ -76,16 +76,17 @@ for f in ./tests/components/$target_component/*.*.yaml; do
|
||||||
# 2. `./tests/test_build_components/build_components_base.[target_platform]-ard.yaml`
|
# 2. `./tests/test_build_components/build_components_base.[target_platform]-ard.yaml`
|
||||||
target_platform_file="./tests/test_build_components/build_components_base.$target_platform.yaml"
|
target_platform_file="./tests/test_build_components/build_components_base.$target_platform.yaml"
|
||||||
if ! [ -f "$target_platform_file" ]; then
|
if ! [ -f "$target_platform_file" ]; then
|
||||||
# Try find arduino test framework as platform.
|
echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml] for component test [$f] found."
|
||||||
target_platform_ard="$target_platform-ard"
|
exit 1
|
||||||
target_platform_file="./tests/test_build_components/build_components_base.$target_platform_ard.yaml"
|
|
||||||
if ! [ -f "$target_platform_file" ]; then
|
|
||||||
echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml, ./tests/build_components_base.$target_platform_ard.yaml] for component test [$f] found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
target_platform=$target_platform_ard
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
start_esphome
|
for target_platform_file in ./tests/test_build_components/build_components_base.$target_platform*.yaml; do
|
||||||
|
# trim off "./tests/test_build_components/build_components_base." prefix
|
||||||
|
target_platform_with_version=${target_platform_file:52}
|
||||||
|
# ...now remove suffix starting with "." leaving just the test target hardware and software platform (possibly with version)
|
||||||
|
# For example: "esp32-s3-idf-50"
|
||||||
|
target_platform_with_version=${target_platform_with_version%.*}
|
||||||
|
start_esphome
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue