I want 2 triggers for my automation.
The “Main” trigger is every 4 seconds.
The “Pre” trigger must occur 1 second (or shorter) before the “Main” trigger.
The “Main” trigger is no problem, but the “Pre” trigger is.
alias: Test triggers
description: ""
triggers:
- trigger: time_pattern
seconds: "/4"
id: main
. . .
It would be helpful if you would give more details about what you are trying to do… using short-cycling time pattern triggers is generally not recommended.
Generally speaking, you would use the earlier event (what you are calling the “Pre” trigger), then use a Wait for trigger action with a timeout… or just a delay if the time pattern is the only thing you’re interested in.
Just be aware that sub-second duration requirements should be treated as “at-least”.
With the main trigger I want to start the main automation, but I want for sure that the data used in the automation is available for processing. That’s why I want to have a pre trigger which take care of that.
Thus pre trigger reads the sensor, then 1 second later the main trigger execute the automation.
But the main trigger must occur every 4 seconds. (4, 8, 12, 16, 20, etc.)
pre trigger (3, 7, 11, 15, 19, etc.)
Do you need a trigger for that to happen?
Or could you just use that sensor data availability as a condition?
most times you don’t need an automation trigger to read sensor data. the system does that for you by design. Or you would use a template trigger sensor if that’s needed.
The main automation runs every 4 seconds.
The (REST) sensor is read every second and this data is used by the automation.
But because the main automation runs every 4 seconds, it is not necessary that the sensor sends the data to the automation every second. If the sensor has the data available 1 second before the main automation starts, that is better.
I’m with Finity, what you are describing doesn’t really make sense within the context of HA automations. A separate trigger would start a separate run of the automation, which wouldn’t report any availability back to the “Main” automation runs… If you’re set on using a Time patter trigger, just fire every 4 seconds and check the availability of the sensors in the condition block.
Guys, thanks for your responses.
On closer inspection, it doesn’t work out the way I envisioned it.
1 Like
If you would describe what it is you are trying to do i.e. what the end goal is, we might be able to point you toward another method that could work.