Different alarm clock depending on shift

Share and discuss your flows and ideas with other users.

Moderator: Martin

cjt7777
Posts: 19
Joined: 09 Aug 2016 12:50

Different alarm clock depending on shift

Post by cjt7777 » 22 Jan 2018 13:44

Hi all,

I'm trying to get a simple alarm clock to change depending on whether I'm on a late or early shift.

I mark my shifts in my Google calendar app as all day events. Lates are marked as "LATES" from Monday-Friday and Early's are marked as "EARLYS" Monday- Friday (these are all day events).

I can't see how to get the flow to check whether the next week is an "Early" or a "Late" event and set the alarm accordingly so any help would be appreciated!

Cheers - Chris

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Different alarm clock depending on shift

Post by Desmanto » 22 Jan 2018 16:36

Did you have a regular shift? I mean it will be one week LATES, one week EARLY and goes on.

There is an action to set alarm, but there is no action to delete it. It is built-in to android. To delete the alarm, we have to use root and delete the database using sqlite.
So probably you have to create your own alarm using automagic. Just use Action sound and choose the song/sound file you hate the most :lol:

The concept is just have two flows to be toggled, one for EARLY, Use trigger Time and set the early time, Mon-Fri. The other for LATES, use trigger Time too, set the late time, Mon-Fri. I use example 07:00 for early and 16:00 for late.
Then another flow, trigger Time at saturday or sunday just to disable Flow 1 and enable flow 2 and vice versa. To toggle them, you can just use execution count : 2.

Flow 1 : Trigger Time : Mon-Fri 07:00
Action : Sound, the sound file you need, Check Show Status bar notification to stop sound (so you can stop it).

Flow 2 : Trigger Time : Mon-Fri 16:00
Action : Sound, the sound file you need, Check Show Status bar notification to stop sound (so you can stop it).

Flow 3 : Trigger Time : Sun 00:00
Condition : Execution count : 2
Action 1 True : Set Flow State : Flow 1 - Enable
Action 2 True : Set Flow State : Flow 2 - Disable
Action 1 False : Set Flow State : Flow 1 - Disable
Action 2 False : Set Flow State : Flow 2 - Enable

But if you have irregular shift, depends on calendar and can change sporadically from time to time, it is better to use Trigger Calendar Event.
You need 2 calendar event flows. EARLY will use the True branch (enable flow 1 and disable flow 2). LATE will use the False branch (disable flow 1 and enable flow 2).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

cjt7777
Posts: 19
Joined: 09 Aug 2016 12:50

Re: Different alarm clock depending on shift

Post by cjt7777 » 23 Jan 2018 14:23

Perfect,

Thanks for your help Desmanto. Shifts are not regular so I'm using the Trigger Calendar Event for EARLYS and LATES to trigger the relevant flow.

Also, nice tip for the 'Show Status bar' notification - I was testing alarms a while back and couldn't stop them!

artpc
Posts: 12
Joined: 02 Jul 2013 11:59

Re: Different alarm clock depending on shift

Post by artpc » 23 Jan 2018 17:52

Use calendar events + AlarmPad , AlarmPad can trigger events from calendar like #Night #Day etc.
If u need I'll share flow for you.

tphg
Posts: 57
Joined: 17 Apr 2017 05:31

Re: Different alarm clock depending on shift

Post by tphg » 26 Jan 2018 01:12

Desmanto wrote: Flow 2 : Trigger Time : Mon-Fri 16:00
Action : Sound, the sound file you need, Check Show Status bar notification to stop sound (so you can stop it).
I also used the Sound action in my another flow, and also checked the "Show Status bar notification to stop sound" but when the phone sounds I could not stop sound by swiping notification and tap it for stopping alarm. It seems there is some restriction in Android or I did something wrong in my Automagic flow.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Different alarm clock depending on shift

Post by Desmanto » 26 Jan 2018 05:29

tphg wrote: I also used the Sound action in my another flow, and also checked the "Show Status bar notification to stop sound" but when the phone sounds I could not stop sound by swiping notification and tap it for stopping alarm. It seems there is some restriction in Android or I did something wrong in my Automagic flow.
What phone do you use? Android version? Maybe you need to grant notification access to automagic. Or probably there are permissions which haven't granted properly. You can try to use stop action sound, to see if it works
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

tphg
Posts: 57
Joined: 17 Apr 2017 05:31

Re: Different alarm clock depending on shift

Post by tphg » 26 Jan 2018 09:48

Desmanto wrote:
tphg wrote: I also used the Sound action in my another flow, and also checked the "Show Status bar notification to stop sound" but when the phone sounds I could not stop sound by swiping notification and tap it for stopping alarm. It seems there is some restriction in Android or I did something wrong in my Automagic flow.
What phone do you use? Android version? Maybe you need to grant notification access to automagic. Or probably there are permissions which haven't granted properly. You can try to use stop action sound, to see if it works
Thanks for your help and advice. I'm using LG G4 with Marshmallow 6.0. Actually I have granted all permission for Automagic as I realize Automagic is priority app that we should give as much permission as we could.
Don't know why but I will try some test to see if it works.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Different alarm clock depending on shift

Post by Desmanto » 26 Jan 2018 11:15

When you tap the notification, did it disappear while the sound still playing? Or it just stay there (sound still playing)?

If stop sound works, the notif should works too. Maybe your phone has additional permission to access the notification. My phone also has separate notification management to manage visible notification. Try to check it there, even though all other permission has been granted.

Try to check also if you have flows with trigger Notification on Statusbar selected. Probably those flows are interfering with the sound notif.

Workaround if it really doesn't work, but stop sound still work; you can add additional Notification on Statusbar, ongoing, set an ID to it, example 5. Then you can use Trigger Notificaton on Statusbar Selected, choose this ID 5. Action : Remove the notification and stop sound. It is a very ugly workaround, since it require additional flow. Better troubleshoot first why the sound still playing after tapped to stop. Maybe try to restart first? Or try to disable/reenable automagic service.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

tphg
Posts: 57
Joined: 17 Apr 2017 05:31

Re: Different alarm clock depending on shift

Post by tphg » 27 Jan 2018 00:29

Desmanto wrote:When you tap the notification, did it disappear while the sound still playing? Or it just stay there (sound still playing)?

If stop sound works, the notif should works too. Maybe your phone has additional permission to access the notification. My phone also has separate notification management to manage visible notification. Try to check it there, even though all other permission has been granted.

Try to check also if you have flows with trigger Notification on Statusbar selected. Probably those flows are interfering with the sound notif.

Workaround if it really doesn't work, but stop sound still work; you can add additional Notification on Statusbar, ongoing, set an ID to it, example 5. Then you can use Trigger Notificaton on Statusbar Selected, choose this ID 5. Action : Remove the notification and stop sound. It is a very ugly workaround, since it require additional flow. Better troubleshoot first why the sound still playing after tapped to stop. Maybe try to restart first? Or try to disable/reenable automagic service.
Many thanks for your detailed instruction.
Yes, I've checked that notification permission in my phone setting as well as in Automagic setting were granted.
After reading your instruction, I've done and checked the followings:
1) When I tapped the Automagic's notification, it disappeared but the sound was still playing.
2) Before tapping Automagic's notification, I acknowledged the event alarm by swiping the event notification so that it disappears before tapping Automagic's notification. But the sound was still playing.
3) Finally based on your earlier advice on testing only the action "Stop sound", I made another flow with a shortcut named "Stop Sound" followed with the action "Stop sound". Then during the event alarm sound playing, I tap this shortcut but the sound didn't stop.
I think the LG firmware has some additional restrictions that the others don't have. That is also the reason why I couldn't use the flow "Turn on GPS when opening map" that you shared before.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Different alarm clock depending on shift

Post by Desmanto » 27 Jan 2018 04:25

Basically this means, once you play a sound, you have no way to stop the sound. Kinda weird, but that's what happen. You can still try a lot of things, such as
- try to choose the built-in sound
- try with another type of sound file (mp3, wav, m4a)
- try disable all automagic permission, restart and reenable everything.
- maybe other method I have think about.

For current other method of workaround, you can :
- create notification and tap it to turn the volume off until the sound stop, restore the volume afterward
- choose a short sound file and loop it. Once you tap the notif, it will break the loop (stop the flow)
- Try to use Seek action sound, forward by so many seconds, see if it will jumps directly to the end of sound file (thus ended it).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply