simplify flow

99 views
Skip to first unread message

Tukker

unread,
Jan 15, 2023, 4:06:42 PM1/15/23
to Automate
Hello,

I'm new here and have not many experience with programming.
I have create a flow to send location to a Telegram channel.
Now i have implemented a variable time depend on speed.

But the speed part using a lot of blocks, how can I simplify this part and use less blocks with the same results?
(Attachment, only flow speed part)

Thanks 

P. Andreas Schmidt, IVE

unread,
Jan 16, 2023, 5:12:57 AM1/16/23
to Automate
Hi Tukker,

well what you've achieved for someone with little experience sounds great to me! Well done
I personally don't really understand what you mean with "a variable time depend on speed". My guess is that instead of a "fixed time" when to send it, your flow awaits for you to be moving at a certain speed, and then to send your location?
In any case, in order to actually help you I think we need your flow, either in text, but prefarably an image or a downloadable one. You mention an attachment, but I don't see anything attached, I'm afraid, I guess something went wrong, so please try again.

With kind regards

Tukker

unread,
Jan 16, 2023, 7:40:35 AM1/16/23
to Automate
Thanks Andreas

I try to upload again. 
The original flow i create send every 20 minutes the location to my channel.
The new flow will send every 5 minutes when i use a bike or i drive slow. (Traffic)
When i use the highway it send every 30 minutes.

The way i created used a several blocks en works fine.
Now i want to learn how to create the same results with less blocks. 😁

Tom

Op maandag 16 januari 2023 om 11:12:57 UTC+1 schreef andreas...@ive.org:

Tukker

unread,
Jan 16, 2023, 7:42:42 AM1/16/23
to Automate

Again🤞
Op maandag 16 januari 2023 om 13:40:35 UTC+1 schreef Tukker:
Location Telegram.flo

P. Andreas Schmidt, IVE

unread,
Jan 17, 2023, 10:59:51 AM1/17/23
to Automate
Hello Tukker,

thx for the flow. There are two things I could suggest, having not studied it profoundly:
1) using your method, you could reduce blocks 5,6,7,9 and 12 into one single block, that would get rid of 4.
You could simply have a variable set block for count, and as Value argument use a conditional operator like this:
speed <= 8 ? count + 20 : speed <= 27 ? count + 5 : count + 3
You could even include the check for >= 100, I guess, and reduce by 2 more blocks (8 & 11):
speed <= 8 ? (count >= 80 ? 0 : count + 20) : speed <= 27 ? (count >= 95 ? 0 : count + 5) : (count >= 97 ? 0 : count + 3)

2) instead of using the get location block to measure the speed (which at least in the flow that you sent checks continually, which sounds pretty wasteful to me, unless you add some delay in between) have you tried using the "Await physical activity" block, having it check for running, bicycling, car driving, and make the time vary on that result? Perhaps a more efficient way altogether...?

Let us know if this helps and if you need any more help.

W.k.r.

Tukker

unread,
Jan 18, 2023, 7:14:47 AM1/18/23
to Automate
Hello Andreas

Thanks you're suggestion did the job but what do you  mean with reduce of block 8 and 11? I think you mean only 11.
At the end I need to sent the location. I keep block 8 with value =0.
It's there any other solution? 

Part 2 will I try in the future, there is a lot to learn. 😃

(In the original flow I use delays and start navigation app, this flow is for testing. )

Best regards
Tukker
Op dinsdag 17 januari 2023 om 16:59:51 UTC+1 schreef andreas...@ive.org:
Location Telegram v2.flo

P. Andreas Schmidt, IVE

unread,
Jan 18, 2023, 8:13:40 AM1/18/23
to automa...@googlegroups.com
Hi there Tukker,

Yes you're right, you still need block 8, but then instead of checking for >= 100 you check =0. And then go to the corresponding block. You got that right.

Any other solution? As in something completely different? You said that depending on your speed you want to send more often or less often. Your solution now I think could have the down side that if you're in the car and it happens to check when you're waiting at a traffic light it will switch to a different timing ... I'm not sure if the await activity block here would be more precise. My guess is it takes more variables into account than just speed, so it might very well. Also you get a probability with each possible activity so that also helps. 
Another way of doing it your way could be using delays (instead of the count variable): when speed is such, then wait X minutes and then send location. This could also be with a forked fiber so you can keep checking "in the background" if there's a change in speed in order to stop that fiber and start it again with right timing...?

Hope this helps

--
You received this message because you are subscribed to a topic in the Google Groups "Automate" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/automate-user/TUCctxnyTug/unsubscribe.
To unsubscribe from this group and all its topics, send an email to automate-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/bac30fde-d7c1-4882-b7fd-2c0fbc89a7ban%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages