esphome / esphome/feature-requests

Add an on_stop trigger to scripts

Open
#2,391 0 comments 0 reactions 0 assignees View on GitHub
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**
I want to be able to trigger an action just after a script has terminated, regardless of the reason for its termination (i.e. regardless of whether it happened because it executed all its code or because `script.stop` was invoked). In addition, I want that trigger to fire after `script.is_running` has switched back to false.

**Please describe your use case for this integration and alternatives you've tried:**
I'd like to update a status LED based on a few different values, among others whether a script `foo` is running. To do so, I create a script `update_led` that evaluates the condition and turns the LED on or off. I then want to call that script whenever any of the inputs to the condition change. Sadly, I'm unable to call it when `foo` stops of its own accord: if I were to call it from `foo` as its last step, `foo` would potentially still be running at the time `update_led` is called.

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.