Allow disabling specific triggers/actions/conditions (#22401)

This commit is contained in:
Franck Nijhof 2022-04-16 13:18:29 +02:00 committed by GitHub
parent fc41d1c77f
commit f36774bfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 0 deletions

View File

@ -879,3 +879,23 @@ automation:
- sensor.two
- sensor.three
```
## Disabling a trigger
Every individual trigger in an automation can be disabled, without removing it.
To do so, add `enabled: false` to the trigger. For example:
```yaml
# Example script with a disabled trigger
automation:
trigger:
# This trigger will not trigger, as it is disabled.
# This automation does not run when the sun is set.
- enabled: false
platform: sun
event: sunset
# This trigger will fire, as it is not disabled.
- platform: time
at: "15:32:00"
```

View File

@ -816,6 +816,31 @@ it encounters an error; it will continue to the next action.
Please note that `continue_on_error` will not suppress/ignore misconfiguration
or errors that Home Assistant does not handle.
## Disabling an action
Every individual action in a sequence can be disabled, without removing it.
To do so, add `enabled: false` to the action. For example:
```yaml
# Example script with a disabled action
script:
example_script:
sequence:
# This action will not run, as it is disabled.
# The message will not be sent.
- enabled: false
alias: "Notify that ceiling light is being turned on"
service: notify.notify
data:
message: "Turning on the ceiling light!"
# This action will run, as it is not disabled
- alias: "Turn on ceiling light"
service: light.turn_on
target:
entity_id: light.ceiling
```
[Script component]: /integrations/script/
[automations]: /getting-started/automation-action/
[Alexa/Amazon Echo]: /integrations/alexa/

View File

@ -630,3 +630,22 @@ condition:
```
{% endraw %}
## Disabling a condition
Every individual condition can be disabled, without removing it.
To do so, add `enabled: false` to the condition configuration.
This can be useful if you want to temporarily disable a condition, for example,
for testing. A disabled condition will always pass.
For example:
```yaml
# This condition will always pass, as it is disabled.
condition:
enabled: false
condition: state
entity_id: sun.sun
state: "above_horizon"
```