From 10eacaccba7c1c6fd50594d85bcdd80c179dcf51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Mar 2025 22:23:26 +0100 Subject: [PATCH 1/5] Bump docker/setup-qemu-action from 3.5.0 to 3.6.0 in the docker-actions group (#8346) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f905ea8782..3cc668c113 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -92,7 +92,7 @@ jobs: uses: docker/setup-buildx-action@v3.10.0 - name: Set up QEMU if: matrix.platform != 'linux/amd64' - uses: docker/setup-qemu-action@v3.5.0 + uses: docker/setup-qemu-action@v3.6.0 - name: Log in to docker hub uses: docker/login-action@v3.3.0 From d9e23fdb5c556595b24253901856b16aa3ac0d4a Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:24:05 +1300 Subject: [PATCH 2/5] [dashboard] Rename trash/delete to archive (#8357) --- esphome/dashboard/web_server.py | 36 +++++++++++++++++++++++---------- esphome/storage_json.py | 4 ++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/esphome/dashboard/web_server.py b/esphome/dashboard/web_server.py index f7888ce6ed..9c20cf4f58 100644 --- a/esphome/dashboard/web_server.py +++ b/esphome/dashboard/web_server.py @@ -39,7 +39,12 @@ from yaml.nodes import Node from esphome import const, platformio_api, yaml_util from esphome.helpers import get_bool_env, mkdir_p -from esphome.storage_json import StorageJSON, ext_storage_path, trash_storage_path +from esphome.storage_json import ( + StorageJSON, + archive_storage_path, + ext_storage_path, + trash_storage_path, +) from esphome.util import get_serial_ports, shlex_quote from esphome.yaml_util import FastestAvailableSafeLoader @@ -936,16 +941,16 @@ class EditRequestHandler(BaseHandler): self.set_status(200) -class DeleteRequestHandler(BaseHandler): +class ArchiveRequestHandler(BaseHandler): @authenticated @bind_config def post(self, configuration: str | None = None) -> None: config_file = settings.rel_path(configuration) storage_path = ext_storage_path(configuration) - trash_path = trash_storage_path() - mkdir_p(trash_path) - shutil.move(config_file, os.path.join(trash_path, configuration)) + archive_path = archive_storage_path() + mkdir_p(archive_path) + shutil.move(config_file, os.path.join(archive_path, configuration)) storage_json = StorageJSON.load(storage_path) if storage_json is not None: @@ -953,16 +958,16 @@ class DeleteRequestHandler(BaseHandler): name = storage_json.name build_folder = os.path.join(settings.config_dir, name) if build_folder is not None: - shutil.rmtree(build_folder, os.path.join(trash_path, name)) + shutil.rmtree(build_folder, os.path.join(archive_path, name)) -class UndoDeleteRequestHandler(BaseHandler): +class UnArchiveRequestHandler(BaseHandler): @authenticated @bind_config def post(self, configuration: str | None = None) -> None: config_file = settings.rel_path(configuration) - trash_path = trash_storage_path() - shutil.move(os.path.join(trash_path, configuration), config_file) + archive_path = archive_storage_path() + shutil.move(os.path.join(archive_path, configuration), config_file) class LoginHandler(BaseHandler): @@ -1203,8 +1208,10 @@ def make_app(debug=get_bool_env(ENV_DEV)) -> tornado.web.Application: (f"{rel}download.bin", DownloadBinaryRequestHandler), (f"{rel}serial-ports", SerialPortRequestHandler), (f"{rel}ping", PingRequestHandler), - (f"{rel}delete", DeleteRequestHandler), - (f"{rel}undo-delete", UndoDeleteRequestHandler), + (f"{rel}delete", ArchiveRequestHandler), + (f"{rel}undo-delete", UnArchiveRequestHandler), + (f"{rel}archive", ArchiveRequestHandler), + (f"{rel}unarchive", UnArchiveRequestHandler), (f"{rel}wizard", WizardRequestHandler), (f"{rel}static/(.*)", StaticFileHandler, {"path": get_static_path()}), (f"{rel}devices", ListDevicesHandler), @@ -1229,6 +1236,13 @@ def start_web_server( config_dir: str, ) -> None: """Start the web server listener.""" + + trash_path = trash_storage_path() + if os.path.exists(trash_path): + _LOGGER.info("Renaming 'trash' folder to 'archive'") + archive_path = archive_storage_path() + shutil.move(trash_path, archive_path) + if socket is None: _LOGGER.info( "Starting dashboard web server on http://%s:%s and configuration dir %s...", diff --git a/esphome/storage_json.py b/esphome/storage_json.py index 97cf9ceadd..fa9fe43d4d 100644 --- a/esphome/storage_json.py +++ b/esphome/storage_json.py @@ -36,6 +36,10 @@ def trash_storage_path() -> str: return CORE.relative_config_path("trash") +def archive_storage_path() -> str: + return CORE.relative_config_path("archive") + + class StorageJSON: def __init__( self, From 29e388b231426de8c6e8deb2f99fc95c4a4258e4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 2 Mar 2025 19:35:32 -0700 Subject: [PATCH 3/5] Bump aioesphomeapi to 29.3.2 (#8353) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 44e7669fdb..2aef8b34f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ platformio==6.1.16 # When updating platformio, also update Dockerfile esptool==4.7.0 click==8.1.7 esphome-dashboard==20250212.0 -aioesphomeapi==29.1.1 +aioesphomeapi==29.3.2 zeroconf==0.145.1 puremagic==1.27 ruamel.yaml==0.18.6 # dashboard_import From 2af5fd5210b5e6849bdb21e0091ccabfb131729c Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:35:52 +1300 Subject: [PATCH 4/5] [ltr390] Move calculation to allow dynamic setting of gain and resolution (#8343) --- esphome/components/ltr390/ltr390.cpp | 14 +++++++------- esphome/components/ltr390/ltr390.h | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/esphome/components/ltr390/ltr390.cpp b/esphome/components/ltr390/ltr390.cpp index 198d15ebd8..84b2eba2de 100644 --- a/esphome/components/ltr390/ltr390.cpp +++ b/esphome/components/ltr390/ltr390.cpp @@ -1,7 +1,7 @@ #include "ltr390.h" +#include #include "esphome/core/hal.h" #include "esphome/core/log.h" -#include namespace esphome { namespace ltr390 { @@ -91,7 +91,12 @@ void LTR390Component::read_uvs_() { uint32_t uv = *val; if (this->uvi_sensor_ != nullptr) { - this->uvi_sensor_->publish_state((uv / this->sensitivity_uv_) * this->wfac_); + // Set sensitivity by linearly scaling against known value in the datasheet + float gain_scale_uv = GAINVALUES[this->gain_uv_] / GAIN_MAX; + float intg_scale_uv = (RESOLUTIONVALUE[this->res_uv_] * 100) / INTG_MAX; + float sensitivity_uv = SENSITIVITY_MAX * gain_scale_uv * intg_scale_uv; + + this->uvi_sensor_->publish_state((uv / sensitivity_uv) * this->wfac_); } if (this->uv_sensor_ != nullptr) { @@ -166,11 +171,6 @@ void LTR390Component::setup() { return; } - // Set sensitivity by linearly scaling against known value in the datasheet - float gain_scale_uv = GAINVALUES[this->gain_uv_] / GAIN_MAX; - float intg_scale_uv = (RESOLUTIONVALUE[this->res_uv_] * 100) / INTG_MAX; - this->sensitivity_uv_ = SENSITIVITY_MAX * gain_scale_uv * intg_scale_uv; - // Set sensor read state this->reading_ = false; diff --git a/esphome/components/ltr390/ltr390.h b/esphome/components/ltr390/ltr390.h index 24afd3c411..7359cbd336 100644 --- a/esphome/components/ltr390/ltr390.h +++ b/esphome/components/ltr390/ltr390.h @@ -77,7 +77,6 @@ class LTR390Component : public PollingComponent, public i2c::I2CDevice { LTR390GAIN gain_uv_; LTR390RESOLUTION res_als_; LTR390RESOLUTION res_uv_; - float sensitivity_uv_; float wfac_; sensor::Sensor *light_sensor_{nullptr}; From 0350eafc1e15f30763fc9170eba960232851b919 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:11:19 +1300 Subject: [PATCH 5/5] [helpers] Allow RAMAllocator to be told the size of the object manually (#8356) --- esphome/core/helpers.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 82b0fe07f8..3f371cd829 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -3,11 +3,11 @@ #include #include #include +#include #include #include #include #include -#include #include "esphome/core/optional.h" @@ -700,8 +700,10 @@ template class RAMAllocator { } template constexpr RAMAllocator(const RAMAllocator &other) : flags_{other.flags_} {} - T *allocate(size_t n) { - size_t size = n * sizeof(T); + T *allocate(size_t n) { return this->allocate(n, sizeof(T)); } + + T *allocate(size_t n, size_t manual_size) { + size_t size = n * manual_size; T *ptr = nullptr; #ifdef USE_ESP32 if (this->flags_ & Flags::ALLOC_EXTERNAL) {