From bae9a950c03f2036456c40b1e7fff4f1f59f9894 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 30 Nov 2022 10:59:20 +1300 Subject: [PATCH 1/4] current-based cover fix copy paste mistake (#4124) --- esphome/components/current_based/current_based_cover.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/current_based/current_based_cover.cpp b/esphome/components/current_based/current_based_cover.cpp index 3d7a9b8425..7edbdf5a72 100644 --- a/esphome/components/current_based/current_based_cover.cpp +++ b/esphome/components/current_based/current_based_cover.cpp @@ -179,7 +179,7 @@ bool CurrentBasedCover::is_closing_blocked_() const { if (this->close_obstacle_current_threshold_ == FLT_MAX) { return false; } - return this->open_sensor_->get_state() > this->open_obstacle_current_threshold_; + return this->close_sensor_->get_state() > this->close_obstacle_current_threshold_; } bool CurrentBasedCover::is_initial_delay_finished_() const { return millis() - this->start_dir_time_ > this->start_sensing_delay_; From 0a19b1e32c7d4ad06c22a6056216b94a4dfee7d5 Mon Sep 17 00:00:00 2001 From: Nicolas Graziano Date: Thu, 1 Dec 2022 01:15:32 +0100 Subject: [PATCH 2/4] Dashboard, after login use relative url. (#4103) --- esphome/dashboard/dashboard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index b7c24f9e2e..2153f15a35 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -849,7 +849,7 @@ PING_REQUEST = threading.Event() class LoginHandler(BaseHandler): def get(self): if is_authenticated(self): - self.redirect("/") + self.redirect("./") else: self.render_login_page() @@ -894,7 +894,7 @@ class LoginHandler(BaseHandler): password = self.get_argument("password", "") if settings.check_password(username, password): self.set_secure_cookie("authenticated", cookie_authenticated_yes) - self.redirect("/") + self.redirect("./") return error_str = ( "Invalid username or password" if settings.username else "Invalid password" From e16ba2adb5edfb041545ae05050cfeef2a16a953 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 1 Dec 2022 13:17:44 +1300 Subject: [PATCH 3/4] Fix queuing scripts not compiling (#4077) --- esphome/components/script/script.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/esphome/components/script/script.h b/esphome/components/script/script.h index f3a83cd6ec..165f90ed11 100644 --- a/esphome/components/script/script.h +++ b/esphome/components/script/script.h @@ -4,6 +4,7 @@ #include "esphome/core/component.h" #include "esphome/core/log.h" +#include namespace esphome { namespace script { @@ -88,7 +89,7 @@ template class RestartScript : public Script { template class QueueingScript : public Script, public Component { public: void execute(Ts... x) override { - if (this->is_action_running()) { + if (this->is_action_running() || this->num_runs_ > 0) { // num_runs_ is the number of *queued* instances, so total number of instances is // num_runs_ + 1 if (this->max_runs_ != 0 && this->num_runs_ + 1 >= this->max_runs_) { @@ -98,6 +99,7 @@ template class QueueingScript : public Script, public Com this->esp_logd_(__LINE__, "Script '%s' queueing new instance (mode: queued)", this->name_.c_str()); this->num_runs_++; + this->var_queue_.push(std::make_tuple(x...)); return; } @@ -114,15 +116,22 @@ template class QueueingScript : public Script, public Com void loop() override { if (this->num_runs_ != 0 && !this->is_action_running()) { this->num_runs_--; - this->trigger(); + auto &vars = this->var_queue_.front(); + this->var_queue_.pop(); + this->trigger_tuple_(vars, typename gens::type()); } } void set_max_runs(int max_runs) { max_runs_ = max_runs; } protected: + template void trigger_tuple_(const std::tuple &tuple, seq /*unused*/) { + this->trigger(std::get(tuple)...); + } + int num_runs_ = 0; int max_runs_ = 0; + std::queue> var_queue_; }; /** A script type that executes new instances in parallel. From 47b3267ed4e57fca2a005abd4fb3db4a5318cdf4 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 1 Dec 2022 13:47:50 +1300 Subject: [PATCH 4/4] Bump version to 2022.11.4 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 8ac844b2b1..f36d776ee4 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2022.11.3" +__version__ = "2022.11.4" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"