Skip to content

fix: send stop for inline tilt at a travel endpoint in self-stopping modes (#142)#143

Merged
clintongormley merged 1 commit into
Sese-Schneider:mainfrom
clintongormley:142-inline-tilt
Jun 30, 2026
Merged

fix: send stop for inline tilt at a travel endpoint in self-stopping modes (#142)#143
clintongormley merged 1 commit into
Sese-Schneider:mainfrom
clintongormley:142-inline-tilt

Conversation

@clintongormley

Copy link
Copy Markdown
Collaborator

Summary

Fixes #142. In inline tilt mode the slats are articulated by the main travel motor, so a tilt move drives the travel relay. When the cover is parked at a travel endpoint (fully open/closed) — the usual case when adjusting slats — the tilt move drives the motor off its limit switch, so it will not self-stop there.

The self-stopping relay modes (Toggle, Pulse, wrapped_self_stops_at_endpoints() True) took the endpoint self-stop branch in auto_stop_if_necessary, which skips the relay stop on the assumption the motor is seated against its physical limit. For a tilt move that assumption is wrong, so the stop was never sent and the cover ran on to the full endpoint — e.g. tilting the slats open while fully closed rolled the blind all the way up.

This is the direct companion to #125, which fixed the analogous overshoot for Switch mode in the adjacent run-on branch (by excluding tilt moves with not self._moving_tilt). #125 added that guard to the run-on branch only; the self-stop branch — the one the momentary/delegated modes take — never got it.

The fix

Hoist the tilt-exclusion into a single shared predicate and gate both endpoint branches on it:

endpoint_applies = self._at_endpoint(current_travel) and not self._moving_tilt

A tilt move at a travel endpoint now falls through to the explicit stop. Real travel moves to an endpoint still skip the redundant stop (a toggle re-pulse would restart the motor — #105). Dual-motor tilt is unaffected (handled by its own earlier _moving_tilt_motor branch). The change is behaviour-preserving for the run-on branch.

Tests

The reporter independently identified the same one-line condition; this PR generalises it (shared predicate, both branches) and adds the missing test coverage for inline tilt on self-stopping modes.

Full suite: 1096 passing; ruff format + check clean.

…modes (Sese-Schneider#142)

In inline tilt mode the slats are articulated by the main travel motor, so a
tilt move drives the travel relay. When the cover is parked at a travel
endpoint (fully open/closed) — the usual case when adjusting slats — the tilt
move drives the motor *off* its limit switch, so it will NOT self-stop there.

The self-stopping relay modes (toggle, pulse, wrapped — _self_stops_at_endpoints()
True) took the endpoint self-stop branch in auto_stop_if_necessary, which skips
the relay stop on the assumption the motor is seated against its physical limit.
For a tilt move that assumption is wrong, so the stop was never sent and the
cover ran on to the full endpoint (e.g. tilting open while fully closed rolled
the blind all the way up).

Sese-Schneider#125 fixed the analogous overshoot for switch mode by excluding tilt moves from
the adjacent run-on branch (not self._moving_tilt). Hoist that exclusion into a
shared `endpoint_applies = _at_endpoint(...) and not _moving_tilt` predicate and
gate both endpoint branches on it, so a tilt move at an endpoint always falls
through to the explicit stop. Real travel moves to an endpoint still skip the
redundant stop (toggle re-pulse would restart the motor — Sese-Schneider#105).

Add tests covering inline tilt at the closed and open endpoints in a
self-stopping mode, plus a regression guard that a travel move to an endpoint
still skips the stop.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an edge case in inline tilt mode where, in self-stopping relay modes, finishing a tilt move while the cover is parked at a travel endpoint (0%/100%) could skip sending a stop command, allowing the motor to run on and drive the cover to the full endpoint (issue #142).

Changes:

  • Introduces a shared endpoint_applies predicate to ensure endpoint “self-stop skip” and “run-on” handling only applies to travel moves (not tilt moves) in auto_stop_if_necessary.
  • Adds regression tests covering inline tilt at both open/closed travel endpoints for self-stopping modes, plus a guard that real travel-to-endpoint still skips stop.
  • Documents the fix in CHANGELOG.md under Unreleased.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
custom_components/cover_time_based/cover_base.py Gates endpoint self-stop/run-on behavior behind a shared predicate that excludes tilt moves, ensuring inline tilt always sends an explicit stop at endpoints.
tests/test_endpoint_self_stop.py Adds tests reproducing issue #142 at both endpoints and verifying travel moves still skip redundant stop in self-stopping modes.
CHANGELOG.md Adds an Unreleased changelog entry describing the inline-tilt endpoint fix and its relation to #125.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@clintongormley clintongormley merged commit 1be9ccd into Sese-Schneider:main Jun 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline tilt mode is opening blinds instead of setting tilt

2 participants