You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that it's not possible to set a return value from the Stop action in an automation if the "Stop because of an unexpected error" toggle is set to TRUE. This makes sense to me. That said, the documentation (cited below) doesn't mention it, so I am making a bit of an assumption here.
Using the action and setting a return variable when the "Stop because of an unexpected error" toggle has never been touched works fine, which is to say the automation will save without an error.
Using the action and setting a return variable with the "Stop because of an unexpected error" toggle set to TRUE throws the following error, which is expected per my reasoning above -- although the error is not very user friendly.
Message malformed: not allowed to add a response to an error stop action @ data['action'][0][<error_or_response>]
However, if after seeing the error, you then toggle the "Stop because of an unexpected error" toggle back to OFF, the error persists and you can't save the script.
A workaround is to switch to YAML mode and remove the error: false map item altogether.
Seems the code may be checking for the "error" key instead of checking it's value?
What version of Home Assistant Core has the issue?
2024.4.3
What was the last working version of Home Assistant Core?
This won't save, but presumably should.description: ""mode: singletrigger: []condition: []action:
- stop: We're done hereresponse_variable: testerror: falsealias: test
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
tomkessler
changed the title
Stop action in automation throws error when a return variable is present and "Stop on Unexpected Error" is toggled on then off
Stop action in automation throws error on save when a return variable is present and "Stop on Unexpected Error" is toggled on then off
Apr 29, 2024
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (automation) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of automation can trigger bot actions by commenting:
@home-assistant close Closes the issue.
@home-assistant rename Awesome new title Renames the issue.
@home-assistant reopen Reopen the issue.
@home-assistant unassign automation Removes the current integration label and assignees on the issue, add the integration domain after the command.
@home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
@home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
It seems that it's not possible to set a return value from the Stop action in an automation if the "Stop because of an unexpected error" toggle is set to TRUE. This makes sense to me. That said, the documentation (cited below) doesn't mention it, so I am making a bit of an assumption here.
Using the action and setting a return variable when the "Stop because of an unexpected error" toggle has never been touched works fine, which is to say the automation will save without an error.
Using the action and setting a return variable with the "Stop because of an unexpected error" toggle set to TRUE throws the following error, which is expected per my reasoning above -- although the error is not very user friendly.
Message malformed: not allowed to add a response to an error stop action @ data['action'][0][<error_or_response>]
However, if after seeing the error, you then toggle the "Stop because of an unexpected error" toggle back to OFF, the error persists and you can't save the script.
A workaround is to switch to YAML mode and remove the
error: false
map item altogether.Seems the code may be checking for the "error" key instead of checking it's value?
What version of Home Assistant Core has the issue?
2024.4.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
No response
Link to integration documentation on our website
https://www.home-assistant.io/docs/scripts/#stopping-a-script-sequence
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: