esphome / esphome/feature-requests

Add `on_timeout` handler in `wait_until` action

Open
#1,790 2 comments 6 reactions 0 assignees View on GitHub
Type: Automation
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

Since [2021.10.0](https://esphome.io/changelog/2021.10.0.html#wait-until) ESPHome supports a `timeout` property on the `wait_until` action, which addresses half of #1339. I would like to extend `wait_until` further with an `on_timeout` property to allow actions to be run if and only if the timeout expired.

**Please describe your use case for this integration and alternatives you've tried:**

My use case is waiting for responses or state changes when communicating with other devices; if no response is received within some time period it usually indicates an error that should be handled, rather than waiting forever.

The new `timeout` property goes a long way towards enabling this, but it still requires some extra work to determine whether the condition was achieved or the action timed out (essentially just checking the condition again).

**Additional context**

Prior context: #1339

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating ESPHome's implementation and tests for the wait_until action and its existing timeout property. Trace how actions are scheduled and how timeout expiration is distinguished from the condition becoming true. Done means an on_timeout action runs only when the timeout expires, with coverage for both outcomes.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.