Hi everyone, is there a way to “block” a flow until a variable is set? I’m currently using the “delay” element, set for a number of seconds, which is approximately enough for a certain variable to populate. I was wondering if there’s a way (or a third-party app) to automate the process.
In advanced flow I connect “calculating” variables in series with other cards. In theory it should start the next in line when it has finished it’s job.
Not sure if there’s any calculation taking more than 1s. You can measure it with a stopwatch: let it start when the variable starts the calculations, and let it stop by using the card @Rmb proposed.
Maybe unrelated, but nonetheless:
In standard flows you always need to add a 1s delay, because all action cards get fired at once without using delays.
Maybe @s_dimaio is referring to a situation where there are two consecutive cards in an advanced flow, the second card uses a variable set by the first, and there is a delay required between the two cards as otherwise the variable is not updated yet. I have noticed that with weather alarm from the KNMI official app.
I consider that as a bug, as I cannot imagine that the second card starts before the first card is completely executed, including updating the variable. Appearantly in this KNMI app the variable Wheather Alarm is updated asynchronous and not in line. I noticed the delay is not required when you use the values returned by the connecting arrow between the flows. That might be a solution for @s_dimaio .
First of all, I changed the title of the post because I’d like to wait until a token is populated (and not a variable).
This is the screenshot with the part of the advanced flow I’m talking about. The flow is connected to an Alexa routine (so it’s activated with a voice command on Alexa). “Alexa called by” is a token that is populated with the serial number of the Echo device executing the command (in this case, the Alexa routine). My problem is that the “Alexa called by” token takes a few seconds to populate, so I had to add a dealy to prevent “echoSerialNumber” from being null.
I’d like to know if there’s a way to eliminate the delay and ensure that the “set echoSerialNumber to …” tab only continues after “Alexa called by” has been set.
I have a similar situation with processing changes in track/artist/album data provided by Sonos.
Whenever any of the Sonos WHEN cards trigger that results in a changed track/artist/album (like ‘Starts playing’ or ‘Track changed’), I need to pauze the flow for 1 sec in order for the track/artist/album tags to be updated.
If I don’t add a delay in the flow, some or all of the tags still contain the prior data. Adding a standard ‘Wait’ flowcard - like you did - works for me. I haven’t come across another (simple) solution.