esphome / esphome/feature-requests
Detect `http_request` timeout, add `on_timeout` trigger
- 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**
A timeout can be set for http_request: https://esphome.io/components/http_request.html
This is great, but it would be nice to detect that timeout has occured and then run a different set of actions.
**Please describe your use case for this integration and alternatives you've tried:**
First use case is interact with a media player via its HTTP API, which is possible only when it's turned ON. It's needed to handle the case when it's not responding - it needs to be turned on first, to connect to the network.
So if it runs on timeout, transmit some IR commands out first to turn it on.
Second use case could be monitoring internet connection by requesting a check IP service like this: http://checkip.dyndns.org/
When this times out, one could assume that the WAN connection of the network needs a restart - so a toggling of a relay to restart the modem/router could be triggered.
These could very well implemented in Home Assistant but since they are local functions, it would be best not to introduce extra points of failure which could lead to unexpected behaviors.
**Additional context**
Implement it simply as `on_timeout` trigger, similar to how `on_response` is.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the http_request documentation linked in the issue and compare the existing on_response trigger with the requested on_timeout behavior. Trace how timeouts are currently handled, then confirm that a timeout can invoke a separate action and that the documented use cases are covered.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100