From b1551d0436c5d438d0fe2e31007efc8545936f0e Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Mon, 15 May 2023 22:24:03 +0200 Subject: [PATCH 01/11] Fix missing stop trait in send_cover_info (#4826) --- esphome/components/api/api_connection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 013b46695d..c350197e68 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -223,6 +223,7 @@ bool APIConnection::send_cover_info(cover::Cover *cover) { msg.assumed_state = traits.get_is_assumed_state(); msg.supports_position = traits.get_supports_position(); msg.supports_tilt = traits.get_supports_tilt(); + msg.supports_stop = traits.get_supports_stop(); msg.device_class = cover->get_device_class(); msg.disabled_by_default = cover->is_disabled_by_default(); msg.icon = cover->get_icon(); From ce5dc6f1003b34bdce0ffd06abbcfc21798b6e72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 08:24:58 +1200 Subject: [PATCH 02/11] Bump aioesphomeapi from 13.7.2 to 13.7.5 (#4830) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a62c48e235..8a2281b96f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ platformio==6.1.6 # When updating platformio, also update Dockerfile esptool==4.5.1 click==8.1.3 esphome-dashboard==20230214.0 -aioesphomeapi==13.7.2 +aioesphomeapi==13.7.5 zeroconf==0.60.0 # esp-idf requires this, but doesn't bundle it by default From ae838b13a85343c7c0016ac0412a920ec1a0859b Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 15 May 2023 21:29:00 +0100 Subject: [PATCH 03/11] Update PulseLightEffect with range brightness (#4820) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/components/light/base_light_effects.h | 9 ++++++++- esphome/components/light/effects.py | 9 +++++++++ esphome/components/shelly_dimmer/light.py | 5 +++-- esphome/const.py | 2 ++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/esphome/components/light/base_light_effects.h b/esphome/components/light/base_light_effects.h index 6291aa0610..9211bba7c9 100644 --- a/esphome/components/light/base_light_effects.h +++ b/esphome/components/light/base_light_effects.h @@ -25,7 +25,7 @@ class PulseLightEffect : public LightEffect { return; } auto call = this->state_->turn_on(); - float out = this->on_ ? 1.0 : 0.0; + float out = this->on_ ? this->max_brightness : this->min_brightness; call.set_brightness_if_supported(out); this->on_ = !this->on_; call.set_transition_length_if_supported(this->transition_length_); @@ -41,11 +41,18 @@ class PulseLightEffect : public LightEffect { void set_update_interval(uint32_t update_interval) { this->update_interval_ = update_interval; } + void set_min_max_brightness(float min, float max) { + this->min_brightness = min; + this->max_brightness = max; + } + protected: bool on_ = false; uint32_t last_color_change_{0}; uint32_t transition_length_{}; uint32_t update_interval_{}; + float min_brightness{0.0}; + float max_brightness{1.0}; }; /// Random effect. Sets random colors every 10 seconds and slowly transitions between them. diff --git a/esphome/components/light/effects.py b/esphome/components/light/effects.py index cef7cd7f3a..c694d6f50c 100644 --- a/esphome/components/light/effects.py +++ b/esphome/components/light/effects.py @@ -28,6 +28,8 @@ from esphome.const import ( CONF_NUM_LEDS, CONF_RANDOM, CONF_SEQUENCE, + CONF_MAX_BRIGHTNESS, + CONF_MIN_BRIGHTNESS, ) from esphome.util import Registry from .types import ( @@ -174,12 +176,19 @@ async def automation_effect_to_code(config, effect_id): cv.Optional( CONF_UPDATE_INTERVAL, default="1s" ): cv.positive_time_period_milliseconds, + cv.Optional(CONF_MIN_BRIGHTNESS, default="0%"): cv.percentage, + cv.Optional(CONF_MAX_BRIGHTNESS, default="100%"): cv.percentage, }, ) async def pulse_effect_to_code(config, effect_id): effect = cg.new_Pvariable(effect_id, config[CONF_NAME]) cg.add(effect.set_transition_length(config[CONF_TRANSITION_LENGTH])) cg.add(effect.set_update_interval(config[CONF_UPDATE_INTERVAL])) + cg.add( + effect.set_min_max_brightness( + config[CONF_MIN_BRIGHTNESS], config[CONF_MAX_BRIGHTNESS] + ) + ) return effect diff --git a/esphome/components/shelly_dimmer/light.py b/esphome/components/shelly_dimmer/light.py index 20e0e8156b..c49193d135 100644 --- a/esphome/components/shelly_dimmer/light.py +++ b/esphome/components/shelly_dimmer/light.py @@ -23,6 +23,8 @@ from esphome.const import ( DEVICE_CLASS_POWER, DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_CURRENT, + CONF_MIN_BRIGHTNESS, + CONF_MAX_BRIGHTNESS, ) from esphome.core import HexInt, CORE @@ -41,8 +43,7 @@ CONF_UPDATE = "update" CONF_LEADING_EDGE = "leading_edge" CONF_WARMUP_BRIGHTNESS = "warmup_brightness" # CONF_WARMUP_TIME = "warmup_time" -CONF_MIN_BRIGHTNESS = "min_brightness" -CONF_MAX_BRIGHTNESS = "max_brightness" + CONF_NRST_PIN = "nrst_pin" CONF_BOOT0_PIN = "boot0_pin" diff --git a/esphome/const.py b/esphome/const.py index b9d8ee81e8..01fcec835b 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -377,6 +377,7 @@ CONF_MAKE_ID = "make_id" CONF_MANUAL_IP = "manual_ip" CONF_MANUFACTURER_ID = "manufacturer_id" CONF_MASK_DISTURBER = "mask_disturber" +CONF_MAX_BRIGHTNESS = "max_brightness" CONF_MAX_COOLING_RUN_TIME = "max_cooling_run_time" CONF_MAX_CURRENT = "max_current" CONF_MAX_DURATION = "max_duration" @@ -396,6 +397,7 @@ CONF_MEDIUM = "medium" CONF_MEMORY_BLOCKS = "memory_blocks" CONF_METHOD = "method" CONF_MICROPHONE = "microphone" +CONF_MIN_BRIGHTNESS = "min_brightness" CONF_MIN_COOLING_OFF_TIME = "min_cooling_off_time" CONF_MIN_COOLING_RUN_TIME = "min_cooling_run_time" CONF_MIN_FAN_MODE_SWITCHING_TIME = "min_fan_mode_switching_time" From 7f83a6e6672bff6abfa73676d4868abf47fcff7d Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 16 May 2023 10:25:49 +1200 Subject: [PATCH 04/11] Bump esphome-dashboard to 20230516.0 (#4831) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8a2281b96f..b791311152 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ pyserial==3.5 platformio==6.1.6 # When updating platformio, also update Dockerfile esptool==4.5.1 click==8.1.3 -esphome-dashboard==20230214.0 +esphome-dashboard==20230516.0 aioesphomeapi==13.7.5 zeroconf==0.60.0 From 8e4aeec3bdc0380efc3967a75b0db1fa728c1179 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Mon, 15 May 2023 23:28:01 +0100 Subject: [PATCH 05/11] Fix time period validation for the auto cleaning interval (#4811) --- esphome/components/sen5x/sensor.py | 2 +- tests/test5.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/sen5x/sensor.py b/esphome/components/sen5x/sensor.py index 489fda8335..392510e417 100644 --- a/esphome/components/sen5x/sensor.py +++ b/esphome/components/sen5x/sensor.py @@ -119,7 +119,7 @@ CONFIG_SCHEMA = ( device_class=DEVICE_CLASS_PM10, state_class=STATE_CLASS_MEASUREMENT, ), - cv.Optional(CONF_AUTO_CLEANING_INTERVAL): cv.time_period_in_seconds_, + cv.Optional(CONF_AUTO_CLEANING_INTERVAL): cv.update_interval, cv.Optional(CONF_VOC): sensor.sensor_schema( icon=ICON_RADIATOR, accuracy_decimals=0, diff --git a/tests/test5.yaml b/tests/test5.yaml index 6b64ef2d15..cb4b559b06 100644 --- a/tests/test5.yaml +++ b/tests/test5.yaml @@ -489,6 +489,7 @@ sensor: offset: 0 normalized_offset_slope: 0 time_constant: 0 + auto_cleaning_interval: 604800s acceleration_mode: low store_baseline: true address: 0x69 From 2a7d6adddee4f5e6482dcb450e55058f3233a563 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 10:30:08 +1200 Subject: [PATCH 06/11] Bump tzlocal from 4.2 to 5.0.1 (#4829) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b791311152..0da1d8a812 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ PyYAML==6.0 paho-mqtt==1.6.1 colorama==0.4.6 tornado==6.3.1 -tzlocal==4.2 # from time +tzlocal==5.0.1 # from time tzdata>=2021.1 # from time pyserial==3.5 platformio==6.1.6 # When updating platformio, also update Dockerfile From d0ca69bc27040b29101a76f120e2fc5c6e13332b Mon Sep 17 00:00:00 2001 From: Justin Gerace Date: Mon, 15 May 2023 16:00:05 -0700 Subject: [PATCH 07/11] Start UART assignment at UART0 if the logger is not enabled or is not configured for hardware logging on ESP32 (#4762) --- .../uart/uart_component_esp32_arduino.cpp | 20 +++++++++++++++++-- .../uart/uart_component_esp32_arduino.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/esphome/components/uart/uart_component_esp32_arduino.cpp b/esphome/components/uart/uart_component_esp32_arduino.cpp index 8bbbc1a650..7306dd2f31 100644 --- a/esphome/components/uart/uart_component_esp32_arduino.cpp +++ b/esphome/components/uart/uart_component_esp32_arduino.cpp @@ -86,10 +86,26 @@ void ESP32ArduinoUARTComponent::setup() { is_default_tx = tx_pin_ == nullptr || tx_pin_->get_pin() == 1; is_default_rx = rx_pin_ == nullptr || rx_pin_->get_pin() == 3; #endif - if (is_default_tx && is_default_rx) { + static uint8_t next_uart_num = 0; + if (is_default_tx && is_default_rx && next_uart_num == 0) { this->hw_serial_ = &Serial; + next_uart_num++; } else { - static uint8_t next_uart_num = 1; +#ifdef USE_LOGGER + // The logger doesn't use this UART component, instead it targets the UARTs + // directly (i.e. Serial/Serial0, Serial1, and Serial2). If the logger is + // enabled, skip the UART that it is configured to use. + if (logger::global_logger->get_baud_rate() > 0 && logger::global_logger->get_uart() == next_uart_num) { + next_uart_num++; + } +#endif // USE_LOGGER + + if (next_uart_num >= UART_NUM_MAX) { + ESP_LOGW(TAG, "Maximum number of UART components created already."); + this->mark_failed(); + return; + } + this->number_ = next_uart_num; this->hw_serial_ = new HardwareSerial(next_uart_num++); // NOLINT(cppcoreguidelines-owning-memory) } diff --git a/esphome/components/uart/uart_component_esp32_arduino.h b/esphome/components/uart/uart_component_esp32_arduino.h index f85c709097..02dfd0531e 100644 --- a/esphome/components/uart/uart_component_esp32_arduino.h +++ b/esphome/components/uart/uart_component_esp32_arduino.h @@ -2,6 +2,7 @@ #ifdef USE_ESP32_FRAMEWORK_ARDUINO +#include #include #include #include "esphome/core/component.h" From d7fd23d8a81e90fab29ca8ec08302b735ce70f62 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 23:13:17 +0000 Subject: [PATCH 08/11] Synchronise Device Classes from Home Assistant (#4825) Co-authored-by: esphomebot --- esphome/components/number/__init__.py | 2 ++ esphome/components/sensor/__init__.py | 2 ++ esphome/const.py | 1 + 3 files changed, 5 insertions(+) diff --git a/esphome/components/number/__init__.py b/esphome/components/number/__init__.py index f532f4e405..73fbfd6e90 100644 --- a/esphome/components/number/__init__.py +++ b/esphome/components/number/__init__.py @@ -57,6 +57,7 @@ from esphome.const import ( DEVICE_CLASS_SULPHUR_DIOXIDE, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, + DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_VOLUME, DEVICE_CLASS_VOLUME_STORAGE, @@ -109,6 +110,7 @@ DEVICE_CLASSES = [ DEVICE_CLASS_SULPHUR_DIOXIDE, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, + DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_VOLUME, DEVICE_CLASS_VOLUME_STORAGE, diff --git a/esphome/components/sensor/__init__.py b/esphome/components/sensor/__init__.py index f0a58d908c..06b96171a7 100644 --- a/esphome/components/sensor/__init__.py +++ b/esphome/components/sensor/__init__.py @@ -73,6 +73,7 @@ from esphome.const import ( DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, + DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_VOLUME, DEVICE_CLASS_VOLUME_STORAGE, @@ -129,6 +130,7 @@ DEVICE_CLASSES = [ DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, + DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_VOLUME, DEVICE_CLASS_VOLUME_STORAGE, diff --git a/esphome/const.py b/esphome/const.py index 01fcec835b..b215619d23 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1005,6 +1005,7 @@ DEVICE_CLASS_TIMESTAMP = "timestamp" DEVICE_CLASS_UPDATE = "update" DEVICE_CLASS_VIBRATION = "vibration" DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS = "volatile_organic_compounds" +DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS = "volatile_organic_compounds_parts" DEVICE_CLASS_VOLTAGE = "voltage" DEVICE_CLASS_VOLUME = "volume" DEVICE_CLASS_VOLUME_STORAGE = "volume_storage" From 2bfcfa6dae52ea3f5f74e0aea93840d518eb43c5 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 16 May 2023 11:30:25 +1200 Subject: [PATCH 09/11] Use token so PR checks are run (#4834) --- .github/workflows/sync-device-classes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-device-classes.yml b/.github/workflows/sync-device-classes.yml index 396dd64165..896a0369ac 100644 --- a/.github/workflows/sync-device-classes.yml +++ b/.github/workflows/sync-device-classes.yml @@ -53,8 +53,8 @@ jobs: commit-message: "Synchronise Device Classes from Home Assistant" committer: esphomebot author: esphomebot - branch: sync/device-classes/ - branch-suffix: timestamp + branch: sync/device-classes delete-branch: true title: "Synchronise Device Classes from Home Assistant" body: ${{ steps.pr-template-body.outputs.body }} + token: ${{ secrets.DEVICE_CLASS_SYNC_TOKEN }} From ab4517f6117e2bc9a346848af1b71e069b1a4e39 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 16 May 2023 16:45:35 +1200 Subject: [PATCH 10/11] Fix stale bot ignoring not-stale (#4836) --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f5d291b49f..3a3e390eef 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -26,7 +26,7 @@ jobs: days-before-issue-close: -1 remove-stale-when-updated: true stale-pr-label: "stale" - exempt-pr-labels: "no-stale" + exempt-pr-labels: "not-stale" stale-pr-message: > There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that From 492bad645b95c58ff1dce12e8484b52b960517bf Mon Sep 17 00:00:00 2001 From: Samuel Sieb Date: Tue, 16 May 2023 04:36:02 -0700 Subject: [PATCH 11/11] support sending keys to the collector (#4838) Co-authored-by: Samuel Sieb --- esphome/components/key_collector/__init__.py | 7 ++++--- esphome/components/key_collector/key_collector.cpp | 2 ++ esphome/components/key_collector/key_collector.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/esphome/components/key_collector/__init__.py b/esphome/components/key_collector/__init__.py index 2099e28109..fd142b3cd7 100644 --- a/esphome/components/key_collector/__init__.py +++ b/esphome/components/key_collector/__init__.py @@ -33,7 +33,7 @@ CONFIG_SCHEMA = cv.All( cv.COMPONENT_SCHEMA.extend( { cv.GenerateID(): cv.declare_id(KeyCollector), - cv.GenerateID(CONF_SOURCE_ID): cv.use_id(key_provider.KeyProvider), + cv.Optional(CONF_SOURCE_ID): cv.use_id(key_provider.KeyProvider), cv.Optional(CONF_MIN_LENGTH): cv.int_, cv.Optional(CONF_MAX_LENGTH): cv.int_, cv.Optional(CONF_START_KEYS): cv.string, @@ -55,8 +55,9 @@ CONFIG_SCHEMA = cv.All( async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) await cg.register_component(var, config) - source = await cg.get_variable(config[CONF_SOURCE_ID]) - cg.add(var.set_provider(source)) + if CONF_SOURCE_ID in config: + source = await cg.get_variable(config[CONF_SOURCE_ID]) + cg.add(var.set_provider(source)) if CONF_MIN_LENGTH in config: cg.add(var.set_min_length(config[CONF_MIN_LENGTH])) if CONF_MAX_LENGTH in config: diff --git a/esphome/components/key_collector/key_collector.cpp b/esphome/components/key_collector/key_collector.cpp index a9213890ee..bf2333d97d 100644 --- a/esphome/components/key_collector/key_collector.cpp +++ b/esphome/components/key_collector/key_collector.cpp @@ -52,6 +52,8 @@ void KeyCollector::clear(bool progress_update) { this->progress_trigger_->trigger(this->result_, 0); } +void KeyCollector::send_key(uint8_t key) { this->key_pressed_(key); } + void KeyCollector::key_pressed_(uint8_t key) { this->last_key_time_ = millis(); if (!this->start_keys_.empty() && !this->start_key_) { diff --git a/esphome/components/key_collector/key_collector.h b/esphome/components/key_collector/key_collector.h index 5e63397839..7ef53929ef 100644 --- a/esphome/components/key_collector/key_collector.h +++ b/esphome/components/key_collector/key_collector.h @@ -27,6 +27,7 @@ class KeyCollector : public Component { void set_timeout(int timeout) { this->timeout_ = timeout; }; void clear(bool progress_update = true); + void send_key(uint8_t key); protected: void key_pressed_(uint8_t key);