diff --git a/esphome/components/es8388/es8388.cpp b/esphome/components/es8388/es8388.cpp index d1834e7043..9deb29416f 100644 --- a/esphome/components/es8388/es8388.cpp +++ b/esphome/components/es8388/es8388.cpp @@ -116,9 +116,8 @@ void ES8388::setup() { if (this->dac_output_select_ != nullptr) { auto dac_power = this->get_dac_power(); if (dac_power.has_value()) { - auto dac_power_str = this->dac_output_select_->at(dac_power.value()); - if (dac_power_str.has_value()) { - this->dac_output_select_->publish_state(dac_power_str.value()); + if (this->dac_output_select_->has_index(dac_power.value())) { + this->dac_output_select_->publish_state(dac_power.value()); } else { ESP_LOGW(TAG, "Unknown DAC output power value: %d", dac_power.value()); } @@ -127,9 +126,8 @@ void ES8388::setup() { if (this->adc_input_mic_select_ != nullptr) { auto mic_input = this->get_mic_input(); if (mic_input.has_value()) { - auto mic_input_str = this->adc_input_mic_select_->at(mic_input.value()); - if (mic_input_str.has_value()) { - this->adc_input_mic_select_->publish_state(mic_input_str.value()); + if (this->adc_input_mic_select_->has_index(mic_input.value())) { + this->adc_input_mic_select_->publish_state(mic_input.value()); } else { ESP_LOGW(TAG, "Unknown ADC input mic value: %d", mic_input.value()); } diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index 2f7b72a1e7..347b45ea72 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -20,6 +20,7 @@ from esphome.const import ( CONF_IGNORE_EFUSE_MAC_CRC, CONF_LOG_LEVEL, CONF_NAME, + CONF_OTA, CONF_PATH, CONF_PLATFORM_VERSION, CONF_PLATFORMIO_OPTIONS, @@ -620,11 +621,18 @@ def final_validate(config): ) ) if advanced[CONF_ENABLE_OTA_ROLLBACK]: - safe_mode_config = full_config.get(CONF_SAFE_MODE) - if safe_mode_config is None or safe_mode_config.get(CONF_DISABLED, False): - _LOGGER.warning( - "OTA rollback requires safe_mode, disabling rollback support" - ) + # "disabled: false" means safe mode *is* enabled. + safe_mode_config = full_config.get(CONF_SAFE_MODE, {CONF_DISABLED: True}) + safe_mode_enabled = not safe_mode_config[CONF_DISABLED] + ota_enabled = CONF_OTA in full_config + # Both need to be enabled for rollback to work + if not (ota_enabled and safe_mode_enabled): + # But only warn if ota is even possible + if ota_enabled: + _LOGGER.warning( + "OTA rollback requires safe_mode, disabling rollback support" + ) + # disable the rollback feature anyway since it can't be used. advanced[CONF_ENABLE_OTA_ROLLBACK] = False if errs: raise cv.MultipleInvalid(errs) diff --git a/esphome/components/zwave_proxy/zwave_proxy.cpp b/esphome/components/zwave_proxy/zwave_proxy.cpp index c1fde4de6b..f8e0f580e9 100644 --- a/esphome/components/zwave_proxy/zwave_proxy.cpp +++ b/esphome/components/zwave_proxy/zwave_proxy.cpp @@ -182,11 +182,15 @@ void ZWaveProxy::send_frame(const uint8_t *data, size_t length) { ESP_LOGV(TAG, "Skipping sending duplicate response: 0x%02X", data[0]); return; } + if (length && data != nullptr) { #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE - char hex_buf[format_hex_pretty_size(ZWAVE_MAX_LOG_BYTES)]; + char hex_buf[format_hex_pretty_size(ZWAVE_MAX_LOG_BYTES)]; #endif - ESP_LOGVV(TAG, "Sending: %s", format_hex_pretty_to(hex_buf, data, length)); - this->write_array(data, length); + ESP_LOGVV(TAG, "Sending: %s", format_hex_pretty_to(hex_buf, data, length)); + this->write_array(data, length); + } else { + ESP_LOGE(TAG, "Null pointer or length 0"); + } } void ZWaveProxy::send_homeid_changed_msg_(api::APIConnection *conn) {