Merge pull request #4012 from esphome/bump-2022.11.0b2

2022.11.0b2
This commit is contained in:
Jesse Hills 2022-11-10 13:33:16 +13:00 committed by GitHub
commit 3aeef1afd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 601 additions and 575 deletions

View file

@ -31,7 +31,7 @@ jobs:
today="$(date --utc '+%Y%m%d')" today="$(date --utc '+%Y%m%d')"
TAG="${TAG}${today}" TAG="${TAG}${today}"
fi fi
echo "::set-output name=tag::${TAG}" echo "tag=${TAG}" >> $GITHUB_OUTPUT
# yamllint enable rule:line-length # yamllint enable rule:line-length
deploy-pypi: deploy-pypi:

View file

@ -13,6 +13,7 @@ using namespace esphome::cover;
CoverTraits CurrentBasedCover::get_traits() { CoverTraits CurrentBasedCover::get_traits() {
auto traits = CoverTraits(); auto traits = CoverTraits();
traits.set_supports_position(true); traits.set_supports_position(true);
traits.set_supports_toggle(true);
traits.set_is_assumed_state(false); traits.set_is_assumed_state(false);
return traits; return traits;
} }
@ -20,6 +21,20 @@ void CurrentBasedCover::control(const CoverCall &call) {
if (call.get_stop()) { if (call.get_stop()) {
this->direction_idle_(); this->direction_idle_();
} }
if (call.get_toggle().has_value()) {
if (this->current_operation != COVER_OPERATION_IDLE) {
this->start_direction_(COVER_OPERATION_IDLE);
this->publish_state();
} else {
if (this->position == COVER_CLOSED || this->last_operation_ == COVER_OPERATION_CLOSING) {
this->target_position_ = COVER_OPEN;
this->start_direction_(COVER_OPERATION_OPENING);
} else {
this->target_position_ = COVER_CLOSED;
this->start_direction_(COVER_OPERATION_CLOSING);
}
}
}
if (call.get_position().has_value()) { if (call.get_position().has_value()) {
auto pos = *call.get_position(); auto pos = *call.get_position();
if (pos == this->position) { if (pos == this->position) {
@ -202,9 +217,11 @@ void CurrentBasedCover::start_direction_(CoverOperation dir) {
trig = this->stop_trigger_; trig = this->stop_trigger_;
break; break;
case COVER_OPERATION_OPENING: case COVER_OPERATION_OPENING:
this->last_operation_ = dir;
trig = this->open_trigger_; trig = this->open_trigger_;
break; break;
case COVER_OPERATION_CLOSING: case COVER_OPERATION_CLOSING:
this->last_operation_ = dir;
trig = this->close_trigger_; trig = this->close_trigger_;
break; break;
default: default:

View file

@ -89,6 +89,8 @@ class CurrentBasedCover : public cover::Cover, public Component {
uint32_t start_dir_time_{0}; uint32_t start_dir_time_{0};
uint32_t last_publish_time_{0}; uint32_t last_publish_time_{0};
float target_position_{0}; float target_position_{0};
cover::CoverOperation last_operation_{cover::COVER_OPERATION_OPENING};
}; };
} // namespace current_based } // namespace current_based

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
"""Constants used by esphome.""" """Constants used by esphome."""
__version__ = "2022.11.0b1" __version__ = "2022.11.0b2"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

View file

@ -313,7 +313,11 @@ class EsphomeUploadHandler(EsphomeCommandWebSocket):
class EsphomeCompileHandler(EsphomeCommandWebSocket): class EsphomeCompileHandler(EsphomeCommandWebSocket):
def build_command(self, json_message): def build_command(self, json_message):
config_file = settings.rel_path(json_message["configuration"]) config_file = settings.rel_path(json_message["configuration"])
return ["esphome", "--dashboard", "compile", config_file] command = ["esphome", "--dashboard", "compile"]
if json_message.get("only_generate", False):
command.append("--only-generate")
command.append(config_file)
return command
class EsphomeValidateHandler(EsphomeCommandWebSocket): class EsphomeValidateHandler(EsphomeCommandWebSocket):

View file

@ -884,6 +884,7 @@ binary_sensor:
then: then:
- cover.toggle: time_based_cover - cover.toggle: time_based_cover
- cover.toggle: endstop_cover - cover.toggle: endstop_cover
- cover.toggle: current_based_cover
- platform: hydreon_rgxx - platform: hydreon_rgxx
hydreon_rgxx_id: hydreon_rg9 hydreon_rgxx_id: hydreon_rg9
too_cold: too_cold:
@ -1246,6 +1247,7 @@ cover:
close_duration: 4.5min close_duration: 4.5min
- platform: current_based - platform: current_based
name: Current Based Cover name: Current Based Cover
id: current_based_cover
open_sensor: ade7953_current_a open_sensor: ade7953_current_a
open_moving_current_threshold: 0.5 open_moving_current_threshold: 0.5
open_obstacle_current_threshold: 0.8 open_obstacle_current_threshold: 0.8