If you need to make a value in a trigger optional in your automation, there is a way.
Full instructions:
This is handy in places where you you want to make sure a trigger is valid before you use it. Be careful, however. If your only triggers are all disabled, the automation no longer has a way to trigger.
Remember the code in the template brackets needs to follow the limited template rules because it needs to be available at the time of trigger.
Here is a sample where you are checking if an optional blueprint !input is populated or not. There are other examples in the Docs.
input:
occupancy:
illuminance:
threshold_entity:
threshold_fixed:
trigger_variables:
occupancy_var: !input occupancy
trigger:
- type: state
entity_id: !input occupancy
enabled: "{{ occupancy_var is not none }}"
from: "on"
to: "off