From 077ee5b7143d1ea033ec513f354b07e07be1b62c Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:05:46 +1300 Subject: [PATCH 1/7] [core] Ignore dot-prefixed config entries when looking for target platform (#8240) --- esphome/core/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/core/config.py b/esphome/core/config.py index 7152414463..2077af02a7 100644 --- a/esphome/core/config.py +++ b/esphome/core/config.py @@ -217,6 +217,8 @@ def preload_core_config(config, result) -> str: target_platforms = [] for domain, _ in config.items(): + if domain.startswith("."): + continue if _is_target_platform(domain): target_platforms += [domain] From c8e7e275a4bedde565867288416acb06bbe0cc51 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 12 Feb 2025 19:17:00 -0600 Subject: [PATCH 2/7] Bump zeroconf to 0.144.1 (#8238) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bbf0ae7f3d..8eca21c4bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ esptool==4.7.0 click==8.1.7 esphome-dashboard==20250212.0 aioesphomeapi==24.6.2 -zeroconf==0.143.0 +zeroconf==0.144.1 puremagic==1.27 ruamel.yaml==0.18.6 # dashboard_import glyphsets==1.0.0 From 4740f12ce8e5e6d63278496e3e8dc909d5a33ab3 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:57:57 +1300 Subject: [PATCH 3/7] [core] Fix ``config_dir`` for dashboard (#8242) --- esphome/core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/__init__.py b/esphome/core/__init__.py index 2d856d99c5..2a7b8b9d91 100644 --- a/esphome/core/__init__.py +++ b/esphome/core/__init__.py @@ -582,7 +582,7 @@ class EsphomeCore: @property def config_dir(self): - return os.path.dirname(os.path.abspath(self.config_path)) + return os.path.abspath(os.path.dirname(self.config_path)) @property def data_dir(self): From 35d303809e8d5b4ed11e0b6bc70065bf417aed75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Poczkodi?= Date: Thu, 13 Feb 2025 04:07:14 +0100 Subject: [PATCH 4/7] [cse7766] Remove stream dependency (#7720) Co-authored-by: Keith Burzinski --- esphome/components/cse7766/cse7766.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index 3907c195d0..88a91e374a 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -1,8 +1,5 @@ #include "cse7766.h" #include "esphome/core/log.h" -#include -#include -#include namespace esphome { namespace cse7766 { @@ -72,12 +69,8 @@ bool CSE7766Component::check_byte_() { void CSE7766Component::parse_data_() { #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE { - std::stringstream ss; - ss << "Raw data:" << std::hex << std::uppercase << std::setfill('0'); - for (uint8_t i = 0; i < 23; i++) { - ss << ' ' << std::setw(2) << static_cast(this->raw_data_[i]); - } - ESP_LOGVV(TAG, "%s", ss.str().c_str()); + std::string s = format_hex_pretty(this->raw_data_, sizeof(this->raw_data_)); + ESP_LOGVV(TAG, "Raw data: %s", s.c_str()); } #endif @@ -211,21 +204,20 @@ void CSE7766Component::parse_data_() { #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE { - std::stringstream ss; - ss << "Parsed:"; + std::string buf = "Parsed:"; if (have_voltage) { - ss << " V=" << voltage << "V"; + buf += str_sprintf(" V=%fV", voltage); } if (have_current) { - ss << " I=" << current * 1000.0f << "mA (~" << calculated_current * 1000.0f << "mA)"; + buf += str_sprintf(" I=%fmA (~%fmA)", current * 1000.0f, calculated_current * 1000.0f); } if (have_power) { - ss << " P=" << power << "W"; + buf += str_sprintf(" P=%fW", power); } if (energy != 0.0f) { - ss << " E=" << energy << "kWh (" << cf_pulses << ")"; + buf += str_sprintf(" E=%fkWh (%u)", energy, cf_pulses); } - ESP_LOGVV(TAG, "%s", ss.str().c_str()); + ESP_LOGVV(TAG, "%s", buf.c_str()); } #endif } From e9a537784e314484dff0e2bd32377177465c33fe Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Wed, 12 Feb 2025 21:37:29 -0600 Subject: [PATCH 5/7] [graph] Remove ``stream`` dependency (#8243) --- esphome/components/graph/graph.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/esphome/components/graph/graph.cpp b/esphome/components/graph/graph.cpp index 09f7557714..cbe059b255 100644 --- a/esphome/components/graph/graph.cpp +++ b/esphome/components/graph/graph.cpp @@ -4,9 +4,6 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" #include -#include -#include // std::cout, std::fixed -#include namespace esphome { namespace graph { @@ -231,9 +228,8 @@ void GraphLegend::init(Graph *g) { ESP_LOGI(TAGL, " %s %d %d", txtstr.c_str(), fw, fh); if (this->values_ != VALUE_POSITION_TYPE_NONE) { - std::stringstream ss; - ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state(); - std::string valstr = ss.str(); + std::string valstr = + value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals()); if (this->units_) { valstr += trace->sensor_->get_unit_of_measurement(); } @@ -368,9 +364,8 @@ void Graph::draw_legend(display::Display *buff, uint16_t x_offset, uint16_t y_of if (legend_->values_ != VALUE_POSITION_TYPE_NONE) { int xv = x + legend_->xv_; int yv = y + legend_->yv_; - std::stringstream ss; - ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state(); - std::string valstr = ss.str(); + std::string valstr = + value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals()); if (legend_->units_) { valstr += trace->sensor_->get_unit_of_measurement(); } From be5639faf1b34fccc0a99c77dabeb87417eb3332 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Wed, 12 Feb 2025 22:34:16 -0600 Subject: [PATCH 6/7] [modbus_controller] Remove `stream` dependency (#8244) --- .../text_sensor/modbus_textsensor.cpp | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp b/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp index acdcacc083..89e86741b0 100644 --- a/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +++ b/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp @@ -1,8 +1,6 @@ #include "modbus_textsensor.h" #include "esphome/core/log.h" -#include -#include namespace esphome { namespace modbus_controller { @@ -12,20 +10,17 @@ static const char *const TAG = "modbus_controller.text_sensor"; void ModbusTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Modbus Controller Text Sensor", this); } void ModbusTextSensor::parse_and_publish(const std::vector &data) { - std::ostringstream output; + std::string output_str{}; uint8_t items_left = this->response_bytes; uint8_t index = this->offset; - char buffer[5]; while ((items_left > 0) && index < data.size()) { uint8_t b = data[index]; switch (this->encode_) { case RawEncoding::HEXBYTES: - sprintf(buffer, "%02x", b); - output << buffer; + output_str += str_snprintf("%02x", 2, b); break; case RawEncoding::COMMA: - sprintf(buffer, index != this->offset ? ",%d" : "%d", b); - output << buffer; + output_str += str_sprintf(index != this->offset ? ",%d" : "%d", b); break; case RawEncoding::ANSI: if (b < 0x20) @@ -33,25 +28,24 @@ void ModbusTextSensor::parse_and_publish(const std::vector &data) { // FALLTHROUGH // Anything else no encoding default: - output << (char) b; + output_str += (char) b; break; } items_left--; index++; } - auto result = output.str(); // Is there a lambda registered // call it with the pre converted value and the raw data array if (this->transform_func_.has_value()) { // the lambda can parse the response itself - auto val = (*this->transform_func_)(this, result, data); + auto val = (*this->transform_func_)(this, output_str, data); if (val.has_value()) { ESP_LOGV(TAG, "Value overwritten by lambda"); - result = val.value(); + output_str = val.value(); } } - this->publish_state(result); + this->publish_state(output_str); } } // namespace modbus_controller From b0f6dd7d9c44690b8e33c87b63acd033a72dc233 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 13 Feb 2025 20:44:12 +1300 Subject: [PATCH 7/7] Bump version to 2025.2.0b2 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 696cc599fc..7390187d7e 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2025.2.0b1" +__version__ = "2025.2.0b2" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" VALID_SUBSTITUTIONS_CHARACTERS = (