From 3d0899aa58859e91b37507be391c0d4845dac005 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 21 Feb 2022 02:05:13 +0100 Subject: [PATCH 1/3] Respect ESPHOME_USE_SUBPROCESS in esp32 post_build script (#3246) --- esphome/components/esp32/post_build.py.script | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/esphome/components/esp32/post_build.py.script b/esphome/components/esp32/post_build.py.script index 2bb1a6c3d6..406516a102 100644 --- a/esphome/components/esp32/post_build.py.script +++ b/esphome/components/esp32/post_build.py.script @@ -1,6 +1,10 @@ # Source https://github.com/letscontrolit/ESPEasy/pull/3845#issuecomment-1005864664 -import esptool +import os +if os.environ.get("ESPHOME_USE_SUBPROCESS") is None: + import esptool +else: + import subprocess from SCons.Script import ARGUMENTS # pylint: disable=E0602 @@ -42,8 +46,11 @@ def esp32_create_combined_bin(source, target, env): print() print(f"Using esptool.py arguments: {' '.join(cmd)}") print() - esptool.main(cmd) + if os.environ.get("ESPHOME_USE_SUBPROCESS") is None: + esptool.main(cmd) + else: + subprocess.run(["esptool.py", *cmd]) # pylint: disable=E0602 env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) # noqa From 95acf1906703d5658dd9cbae8ef61afe74ac737a Mon Sep 17 00:00:00 2001 From: Nicholas Peters Date: Mon, 21 Feb 2022 19:53:24 -0500 Subject: [PATCH 2/3] Fix regression caused by TSL2591 auto gain (#3249) --- esphome/components/tsl2591/tsl2591.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/esphome/components/tsl2591/tsl2591.cpp b/esphome/components/tsl2591/tsl2591.cpp index 8a540c5f13..f8c59a53c6 100644 --- a/esphome/components/tsl2591/tsl2591.cpp +++ b/esphome/components/tsl2591/tsl2591.cpp @@ -43,16 +43,34 @@ void TSL2591Component::disable_if_power_saving_() { } void TSL2591Component::setup() { - if (this->component_gain_ == TSL2591_CGAIN_AUTO) - this->gain_ = TSL2591_GAIN_MED; + switch (this->component_gain_) { + case TSL2591_CGAIN_LOW: + this->gain_ = TSL2591_GAIN_LOW; + break; + case TSL2591_CGAIN_MED: + this->gain_ = TSL2591_GAIN_MED; + break; + case TSL2591_CGAIN_HIGH: + this->gain_ = TSL2591_GAIN_HIGH; + break; + case TSL2591_CGAIN_MAX: + this->gain_ = TSL2591_GAIN_MAX; + break; + case TSL2591_CGAIN_AUTO: + this->gain_ = TSL2591_GAIN_MED; + break; + } + uint8_t address = this->address_; ESP_LOGI(TAG, "Setting up TSL2591 sensor at I2C address 0x%02X", address); + uint8_t id; if (!this->read_byte(TSL2591_COMMAND_BIT | TSL2591_REGISTER_DEVICE_ID, &id)) { ESP_LOGE(TAG, "Failed I2C read during setup()"); this->mark_failed(); return; } + if (id != 0x50) { ESP_LOGE(TAG, "Could not find the TSL2591 sensor. The ID register of the device at address 0x%02X reported 0x%02X " @@ -61,6 +79,7 @@ void TSL2591Component::setup() { this->mark_failed(); return; } + this->set_integration_time_and_gain(this->integration_time_, this->gain_); this->disable_if_power_saving_(); } From 97aca8e54c62e514c7cd042c1f3c2f7c8f789a06 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:20:48 +1300 Subject: [PATCH 3/3] Bump version to 2022.2.5 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 015a598ded..7cd88a8101 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2022.2.4" +__version__ = "2022.2.5" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"