These variables can only contain limited templates. These are defined using the trigger_variables key at an automation level. The second variant is setting variables that are available when attaching a trigger when the trigger can contain templated values. The variables will be able to use templates and have access to the trigger variable. The first variant allows you to define variables that will be set when the trigger fires. There are two different types of variables available for triggers. The id does not have to be unique for each trigger, and it can be used to group similar triggers for use later in the automation (i.e., several triggers of different types that should all turn some entity on).Īutomation : trigger : - platform : event event_type : " MY_CUSTOM_EVENT" id : " custom_event" - platform : mqtt topic : " living_room/switch/ac" id : " ac_on" - platform : state # This trigger will be assigned id="2" entity_id : - device_tracker.paulus - device_tracker.anne_therese to : " home" Trigger variables The id can be referenced from trigger conditions and actions.
If the ID is omitted, it will instead be set to the index of the trigger. Multiple Entity IDs for the same TriggerĪll triggers can be assigned an optional id.It is also possible to specify multiple triggers for one automation. These can be specified directly or more flexible via templates. When any of the automation’s triggers becomes true (trigger fires), Home Assistant will validate the conditions, if any, and call the action.Īn automation can be triggered by an event, with a certain entity state, at a given time, and more. Triggers are what starts the processing of an automation rule.