-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure scripts with timeouts of zero timeout immediately #115830
Conversation
We may want to consider the effect this has on the frontend, it may be confusing. Currently no timeout is rendered as 00:00:00:000 e.g.: So currently timeout: 0 and no timeout have the same behavior, and both render the same. If we make timeout: 0 act as immediate timeout, this means that both no timeout, and instant timeout will both render identically in the frontend UI, but will have different behavior. There may be people with legacy automations saved that accidentally touched this control, or changed it back to 0, and may be lingering unaware in their yaml. For those this would be a breaking change? |
I'm pretty sure this is a regression in 2024.4.x and Plan is to validate that before I mark it ready, but I can't |
I did manage to get enough bandwidth to downgrade to 2024.3.3 in flight |
I did not consider the zero use case when I refactored the I guess that means we did not ever consider it on the frontend |
#109586 looks like they want the behavior the other way Its not clear what the correct behavior is here I'm going to close |
Also not clear is if we did timeout right away with zero, should the template/trigger still fire if the condition is true or should the timeout force it to timeout right away. With the wait template it would still fire, but with the trigger it would not. |
It seems like we should fix the regression (which is what this PR aims to do). However, the correct behavior is not clear here, a second opinion is needed. |
https://www.home-assistant.io/docs/scripts/#wait-timeout it does not appear to be documented how a zero timeout should be handled |
I tend to side on restoring the status quo since even if it was not documented changing the behavior is a regression. Also it does not seem to make much sense to specify a timeout and than not expect it to be enforced, but the same could be said about a zero timeout not making much sense |
After reading the discussion in #109586 it seems like we should fix the regression and than modify the UI to be able to delete the timeout without having to drop back to YAML to remove it. |
related: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @bdraco 👍
Odd situation, but I agree we should address the regression for now first.
../Frenck
Thanks a lot! Guys, please add a corr. remark to Docs. |
I think the gist is: We don't know what the expected or correct way to handling it is. This for now, fixes a regression, but I honestly don't think this is the correct behavior we should document and aim for (or maybe it is, but that need to be figured out). |
To add a use case for this (I've been hit by this bug). I'm using a So while I do agree that a hardcoded timeout of 00:00:00 doesn't really make sense, I do believe there is a use case for it when it's conditional, based on a template. As it keeps the script a bit cleaner (doesn't require wrapping the |
Another use-case - using in a blueprint:
where |
I don't think this is the right place for this discussion. Let's keep it at the review here :) |
Proposed change
Ensure scripts with timeouts of zero timeout immediately. A zero wait timeout was seen as no timeout
This fixes a regression in 2024.4.x from https://github.com/home-assistant/core/pull/113183/files#r1571980213 and restores the behavior to what it was with 2024.3.x.
It was not an intentional to have no timeout when its set to zero and this likely breaks some use cases where the user was expecting the condition to be either true immediately or timeout. Its been pointed out that #109586 requested that a zero timeout be treated as no timeout but it seems the reasoning for that is that there is no way to turn off the timeout in the UI once its been chosen. From a backend perspective it makes more sense to me to fix the regression, and in the future adjust the UI so the timeout can be removed without having to manually edit in YAML to remove it.
fixes #115786
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: