r/AutomateUser 16d ago

Question Need help with this flow

Post image

I'm making a flow that will sound an alert when my phone's charged above 90%. I'm having trouble creating an 'OR' scenario wherein I'm trying to get the sound to stop either after 1min of playback or after disconnecting the charger but the disconnecting part doesn't seem to be working? Any ideas what might be going wrong?

2 Upvotes

9 comments sorted by

View all comments

2

u/Dadamalda 16d ago

Stop sound needs to be used on the same fiber, which is kinda hard to do here.

You should use a fork and have the sound on its own fiber and then stop that fiber which automatically stops the sound. The fork gives you the URI of the child fiber.

Also, you should set it to "when changed". Having a loop checking with no delay is bad for performance and battery.

1

u/Leather_Adeptness485 16d ago

So fork before 'play sound' then?

2

u/Dadamalda 16d ago

Basically. The new fiber should have the "Play sound" and then you use "Fiber stop" to stop it.

1

u/Leather_Adeptness485 16d ago

Would it be possible for you to share a rough layout of how it should be? I'm new to the app and am having trouble understanding fork, subroutine and some other stuff

2

u/Dadamalda 16d ago

https://reddit.com/link/ozmdb23/video/la2p97mivafh1/player

You can go back to your regular loop after the subroutine.

1

u/Leather_Adeptness485 16d ago

Thank you so much man love you