Page 1 of 1

Trigger when idle

Posted: 09 Jul 2019 10:40
by holymoz
Hi, My phone often does not turn off the screen when I don't use it.
I still have the screen on and consumes battery. Is There a trigger that can sense when phone is not used even with the screen on? Thanks

Re: Trigger when idle

Posted: 09 Jul 2019 11:09
by Wibbly
Depends how you define "idle".

- Is, say, watching a video and not touching the phone, etc. 'idle''? I would say not
- Is it being on the home screen and not touching it 'idel'? Maybe
- etc.

If the normal screen timeout is not working, you need to investigate why?

Re: Trigger when idle

Posted: 09 Jul 2019 14:04
by holymoz
the normal screen timeout not works everytime, sometimes the screen doesn't go off.
as you say watching videos is not idle, the trigger must act when phone is not used by any apps on screen

Re: Trigger when idle

Posted: 09 Jul 2019 14:35
by anuraag
You can try creating a flow with ui event trigger. Set multiple triggers of ui event. Like Component clicked, component long clicked, focused etc. Set flow execution policy to "Stop the currently executing instance and then execute the newer instance". Add a script to set a global_variable to 30sec after trigger.

Create another flow with global_variable (created from previous flow) as trigger. Use whatever method available for turning screen off.

Re: Trigger when idle

Posted: 09 Jul 2019 14:48
by Wibbly
anuraag wrote:
09 Jul 2019 14:35
You can try creating a flow with ui event trigger. Set multiple triggers of ui event. Like Component clicked, component long clicked, focused etc. Set flow execution policy to "Stop the currently executing instance and then execute the newer instance". Add a script to set a global_variable to 30sec after trigger.

Create another flow with global_variable (created from previous flow) as trigger. Use whatever method available for turning screen off.
I think this won't work if you are, say, watching a video. Maybe you have to have a condition that it's on the home screen too?

@holymoz: But as I said, I would first get to the bottom of why "the normal screen timeout not works everytime, sometimes the screen doesn't go off". It sounds like a bad app is making this happen (keeping the screen on). Or maybe you have another flow that has left the screen to a very long timeout?

Maybe use a ui event trigger flow as suggested by @anuraag with the action to just explicitly set (i.e. reset) the screen timeout to a low value, but this is putting a plaster over why it's not turning off when it should anyway, not fixing the root problem.

Re: Trigger when idle

Posted: 09 Jul 2019 14:58
by anuraag
Here an extra flow will be need with trigger "app task started" which will disable ui event and global_variable trigger. And "app task ended" will enable them.

Re: Trigger when idle

Posted: 09 Jul 2019 17:15
by Desmanto
@holymoz : I agree with Wibbly, you should find the root cause, instead of using Automagic to solve the bad outcome.

But if you still need to have trigger on idle, you can take a look at my screen saver flow : viewtopic.php?f=3&t=6963
This will trigger when you don't touch the screen for some period. But you will have a flow always running background (the sleep action), so it is not feasible to save your battery. I can modify it to glovardt version if you need a longer period, but I think it doesn't worth it. You should investigate the root instead, rather than creating flow for alternative solution.

As pointed by anuraag, you can use app task started/ended to disable/enable the always running flow when opening certain apps.

Re: Trigger when idle

Posted: 09 Jul 2019 18:06
by holymoz
Thanks to all, will try something and search for the cause