Merge pull request #6607 from esphome/bump-2024.4.1

2024.4.1
This commit is contained in:
Jesse Hills 2024-04-23 11:51:30 +12:00 committed by GitHub
commit fcd9e3cb5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 90 additions and 39 deletions

View file

@ -316,17 +316,26 @@ def _parse_platform_version(value):
def _detect_variant(value): def _detect_variant(value):
if CONF_VARIANT not in value:
board = value[CONF_BOARD] board = value[CONF_BOARD]
if board not in BOARDS: if board in BOARDS:
variant = BOARDS[board][KEY_VARIANT]
if CONF_VARIANT in value and variant != value[CONF_VARIANT]:
raise cv.Invalid( raise cv.Invalid(
"This board is unknown, please set the variant manually", f"Option '{CONF_VARIANT}' does not match selected board.",
path=[CONF_VARIANT],
)
value = value.copy()
value[CONF_VARIANT] = variant
else:
if CONF_VARIANT not in value:
raise cv.Invalid(
"This board is unknown, if you are sure you want to compile with this board selection, "
f"override with option '{CONF_VARIANT}'",
path=[CONF_BOARD], path=[CONF_BOARD],
) )
_LOGGER.warning(
value = value.copy() "This board is unknown. Make sure the chosen chip component is correct.",
value[CONF_VARIANT] = BOARDS[board][KEY_VARIANT] )
return value return value

View file

@ -364,8 +364,12 @@ void ESP32BLETracker::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_ga
} }
void ESP32BLETracker::gap_scan_set_param_complete_(const esp_ble_gap_cb_param_t::ble_scan_param_cmpl_evt_param &param) { void ESP32BLETracker::gap_scan_set_param_complete_(const esp_ble_gap_cb_param_t::ble_scan_param_cmpl_evt_param &param) {
if (param.status == ESP_BT_STATUS_DONE) {
this->scan_set_param_failed_ = ESP_BT_STATUS_SUCCESS;
} else {
this->scan_set_param_failed_ = param.status; this->scan_set_param_failed_ = param.status;
} }
}
void ESP32BLETracker::gap_scan_start_complete_(const esp_ble_gap_cb_param_t::ble_scan_start_cmpl_evt_param &param) { void ESP32BLETracker::gap_scan_start_complete_(const esp_ble_gap_cb_param_t::ble_scan_start_cmpl_evt_param &param) {
this->scan_start_failed_ = param.status; this->scan_start_failed_ = param.status;

View file

@ -55,11 +55,13 @@ void InternalTemperatureSensor::update() {
uint32_t raw, result; uint32_t raw, result;
result = temp_single_get_current_temperature(&raw); result = temp_single_get_current_temperature(&raw);
success = (result == 0); success = (result == 0);
#ifdef USE_LIBRETINY_VARIANT_BK7231T #if defined(USE_LIBRETINY_VARIANT_BK7231N)
temperature = raw * -0.38f + 156.0f;
#elif defined(USE_LIBRETINY_VARIANT_BK7231T)
temperature = raw * 0.04f; temperature = raw * 0.04f;
#else #else // USE_LIBRETINY_VARIANT
temperature = raw * 0.128f; temperature = raw * 0.128f;
#endif // USE_LIBRETINY_VARIANT_BK7231T #endif // USE_LIBRETINY_VARIANT
#endif // USE_BK72XX #endif // USE_BK72XX
if (success && std::isfinite(temperature)) { if (success && std::isfinite(temperature)) {
this->publish_state(temperature); this->publish_state(temperature);

View file

@ -1,6 +1,10 @@
import json import json
import logging import logging
from os.path import dirname, isfile, join from os.path import (
dirname,
isfile,
join,
)
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
@ -55,15 +59,25 @@ def _detect_variant(value):
component: LibreTinyComponent = CORE.data[KEY_LIBRETINY][KEY_COMPONENT_DATA] component: LibreTinyComponent = CORE.data[KEY_LIBRETINY][KEY_COMPONENT_DATA]
board = value[CONF_BOARD] board = value[CONF_BOARD]
# read board-default family if not specified # read board-default family if not specified
if CONF_FAMILY not in value:
if board not in component.boards: if board not in component.boards:
if CONF_FAMILY not in value:
raise cv.Invalid( raise cv.Invalid(
"This board is unknown, please set the family manually. " "This board is unknown, if you are sure you want to compile with this board selection, "
"Also, make sure the chosen chip component is correct.", f"override with option '{CONF_FAMILY}'",
path=[CONF_BOARD], path=[CONF_BOARD],
) )
_LOGGER.warning(
"This board is unknown. Make sure the chosen chip component is correct.",
)
else:
family = component.boards[board][KEY_FAMILY]
if CONF_FAMILY in value and family != value[CONF_FAMILY]:
raise cv.Invalid(
f"Option '{CONF_FAMILY}' does not match selected board.",
path=[CONF_FAMILY],
)
value = value.copy() value = value.copy()
value[CONF_FAMILY] = component.boards[board][KEY_FAMILY] value[CONF_FAMILY] = family
# read component name matching this family # read component name matching this family
value[CONF_COMPONENT_ID] = FAMILY_COMPONENT[value[CONF_FAMILY]] value[CONF_COMPONENT_ID] = FAMILY_COMPONENT[value[CONF_FAMILY]]
# make sure the chosen component matches the family # make sure the chosen component matches the family
@ -72,11 +86,6 @@ def _detect_variant(value):
f"The chosen family doesn't belong to '{component.name}' component. The correct component is '{value[CONF_COMPONENT_ID]}'", f"The chosen family doesn't belong to '{component.name}' component. The correct component is '{value[CONF_COMPONENT_ID]}'",
path=[CONF_FAMILY], path=[CONF_FAMILY],
) )
# warn anyway if the board wasn't found
if board not in component.boards:
_LOGGER.warning(
"This board is unknown. Make sure the chosen chip component is correct.",
)
return value return value

View file

@ -359,11 +359,15 @@ OrFilter::OrFilter(std::vector<Filter *> filters) : filters_(std::move(filters))
OrFilter::PhiNode::PhiNode(OrFilter *or_parent) : or_parent_(or_parent) {} OrFilter::PhiNode::PhiNode(OrFilter *or_parent) : or_parent_(or_parent) {}
optional<float> OrFilter::PhiNode::new_value(float value) { optional<float> OrFilter::PhiNode::new_value(float value) {
if (!this->or_parent_->has_value_) {
this->or_parent_->output(value); this->or_parent_->output(value);
this->or_parent_->has_value_ = true;
}
return {}; return {};
} }
optional<float> OrFilter::new_value(float value) { optional<float> OrFilter::new_value(float value) {
this->has_value_ = false;
for (Filter *filter : this->filters_) for (Filter *filter : this->filters_)
filter->input(value); filter->input(value);

View file

@ -388,6 +388,7 @@ class OrFilter : public Filter {
}; };
std::vector<Filter *> filters_; std::vector<Filter *> filters_;
bool has_value_{false};
PhiNode phi_; PhiNode phi_;
}; };

View file

@ -208,7 +208,7 @@ async def to_code(config):
cg.add(var.set_switch_id(switch_datapoint)) cg.add(var.set_switch_id(switch_datapoint))
if active_state_config := config.get(CONF_ACTIVE_STATE): if active_state_config := config.get(CONF_ACTIVE_STATE):
cg.add(var.set_active_state_id(CONF_DATAPOINT)) cg.add(var.set_active_state_id(active_state_config.get(CONF_DATAPOINT)))
if (heating_value := active_state_config.get(CONF_HEATING_VALUE)) is not None: if (heating_value := active_state_config.get(CONF_HEATING_VALUE)) is not None:
cg.add(var.set_active_state_heating_value(heating_value)) cg.add(var.set_active_state_heating_value(heating_value))
if (cooling_value := active_state_config.get(CONF_COOLING_VALUE)) is not None: if (cooling_value := active_state_config.get(CONF_COOLING_VALUE)) is not None:
@ -219,14 +219,10 @@ async def to_code(config):
cg.add(var.set_active_state_fanonly_value(fanonly_value)) cg.add(var.set_active_state_fanonly_value(fanonly_value))
else: else:
if heating_state_pin_config := config.get(CONF_HEATING_STATE_PIN): if heating_state_pin_config := config.get(CONF_HEATING_STATE_PIN):
heating_state_pin = await cg.gpio_pin_expression( heating_state_pin = await cg.gpio_pin_expression(heating_state_pin_config)
config(heating_state_pin_config)
)
cg.add(var.set_heating_state_pin(heating_state_pin)) cg.add(var.set_heating_state_pin(heating_state_pin))
if cooling_state_pin_config := config.get(CONF_COOLING_STATE_PIN): if cooling_state_pin_config := config.get(CONF_COOLING_STATE_PIN):
cooling_state_pin = await cg.gpio_pin_expression( cooling_state_pin = await cg.gpio_pin_expression(cooling_state_pin_config)
config(cooling_state_pin_config)
)
cg.add(var.set_cooling_state_pin(cooling_state_pin)) cg.add(var.set_cooling_state_pin(cooling_state_pin))
if target_temperature_datapoint := config.get(CONF_TARGET_TEMPERATURE_DATAPOINT): if target_temperature_datapoint := config.get(CONF_TARGET_TEMPERATURE_DATAPOINT):
@ -254,11 +250,11 @@ async def to_code(config):
if preset_config := config.get(CONF_PRESET, {}): if preset_config := config.get(CONF_PRESET, {}):
if eco_config := preset_config.get(CONF_ECO, {}): if eco_config := preset_config.get(CONF_ECO, {}):
cg.add(var.set_eco_id(CONF_DATAPOINT)) cg.add(var.set_eco_id(eco_config.get(CONF_DATAPOINT)))
if eco_temperature := eco_config.get(CONF_TEMPERATURE): if eco_temperature := eco_config.get(CONF_TEMPERATURE):
cg.add(var.set_eco_temperature(eco_temperature)) cg.add(var.set_eco_temperature(eco_temperature))
if CONF_SLEEP in preset_config: if sleep_config := preset_config.get(CONF_SLEEP, {}):
cg.add(var.set_sleep_id(CONF_DATAPOINT)) cg.add(var.set_sleep_id(sleep_config.get(CONF_DATAPOINT)))
if swing_mode_config := config.get(CONF_SWING_MODE): if swing_mode_config := config.get(CONF_SWING_MODE):
if swing_vertical_datapoint := swing_mode_config.get(CONF_VERTICAL_DATAPOINT): if swing_vertical_datapoint := swing_mode_config.get(CONF_VERTICAL_DATAPOINT):
@ -268,7 +264,7 @@ async def to_code(config):
): ):
cg.add(var.set_swing_horizontal_id(swing_horizontal_datapoint)) cg.add(var.set_swing_horizontal_id(swing_horizontal_datapoint))
if fan_mode_config := config.get(CONF_FAN_MODE): if fan_mode_config := config.get(CONF_FAN_MODE):
cg.add(var.set_fan_speed_id(CONF_DATAPOINT)) cg.add(var.set_fan_speed_id(fan_mode_config.get(CONF_DATAPOINT)))
if (fan_auto_value := fan_mode_config.get(CONF_AUTO_VALUE)) is not None: if (fan_auto_value := fan_mode_config.get(CONF_AUTO_VALUE)) is not None:
cg.add(var.set_fan_speed_auto_value(fan_auto_value)) cg.add(var.set_fan_speed_auto_value(fan_auto_value))
if (fan_low_value := fan_mode_config.get(CONF_LOW_VALUE)) is not None: if (fan_low_value := fan_mode_config.get(CONF_LOW_VALUE)) is not None:

View file

@ -128,7 +128,7 @@ void WiFiComponent::loop() {
case WIFI_COMPONENT_STATE_COOLDOWN: { case WIFI_COMPONENT_STATE_COOLDOWN: {
this->status_set_warning(); this->status_set_warning();
if (millis() - this->action_started_ > 5000) { if (millis() - this->action_started_ > 5000) {
if (this->fast_connect_) { if (this->fast_connect_ || this->retry_hidden_) {
this->start_connecting(this->sta_[0], false); this->start_connecting(this->sta_[0], false);
} else { } else {
this->start_scanning(); this->start_scanning();
@ -591,6 +591,9 @@ void WiFiComponent::check_connecting_finished() {
return; return;
} }
// We won't retry hidden networks unless a reconnect fails more than three times again
this->retry_hidden_ = false;
ESP_LOGI(TAG, "WiFi Connected!"); ESP_LOGI(TAG, "WiFi Connected!");
this->print_connect_params_(); this->print_connect_params_();
@ -668,10 +671,11 @@ void WiFiComponent::retry_connect() {
this->wifi_mode_(false, {}); this->wifi_mode_(false, {});
delay(100); // NOLINT delay(100); // NOLINT
this->num_retried_ = 0; this->num_retried_ = 0;
this->retry_hidden_ = false;
} else { } else {
// Try hidden networks after 3 failed retries // Try hidden networks after 3 failed retries
ESP_LOGD(TAG, "Retrying with hidden networks..."); ESP_LOGD(TAG, "Retrying with hidden networks...");
this->fast_connect_ = true; this->retry_hidden_ = true;
this->num_retried_++; this->num_retried_++;
} }
} else { } else {

View file

@ -371,6 +371,7 @@ class WiFiComponent : public Component {
std::vector<WiFiSTAPriority> sta_priorities_; std::vector<WiFiSTAPriority> sta_priorities_;
WiFiAP selected_ap_; WiFiAP selected_ap_;
bool fast_connect_{false}; bool fast_connect_{false};
bool retry_hidden_{false};
bool has_ap_{false}; bool has_ap_{false};
WiFiAP ap_; WiFiAP ap_;

View file

@ -1,6 +1,6 @@
"""Constants used by esphome.""" """Constants used by esphome."""
__version__ = "2024.4.0" __version__ = "2024.4.1"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
VALID_SUBSTITUTIONS_CHARACTERS = ( VALID_SUBSTITUTIONS_CHARACTERS = (

View file

@ -10,6 +10,7 @@ import paho.mqtt.client as mqtt
from esphome.const import ( from esphome.const import (
CONF_BROKER, CONF_BROKER,
CONF_CERTIFICATE_AUTHORITY,
CONF_DISCOVERY_PREFIX, CONF_DISCOVERY_PREFIX,
CONF_ESPHOME, CONF_ESPHOME,
CONF_LOG_TOPIC, CONF_LOG_TOPIC,
@ -99,7 +100,9 @@ def prepare(
elif username: elif username:
client.username_pw_set(username, password) client.username_pw_set(username, password)
if config[CONF_MQTT].get(CONF_SSL_FINGERPRINTS): if config[CONF_MQTT].get(CONF_SSL_FINGERPRINTS) or config[CONF_MQTT].get(
CONF_CERTIFICATE_AUTHORITY
):
if sys.version_info >= (2, 7, 13): if sys.version_info >= (2, 7, 13):
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
else: else:

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"