sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
MIT License
2.58k stars 109 forks source link

Proposal: Is Low Power Mode On needs a delay #136

Closed frkd-dev closed 1 year ago

frkd-dev commented 1 year ago

Hello there,

I'm currently facing an issue with the "Is Low Power Mode On" action: when the action runs from Shortcuts' automation, it does not always detect a proper state. To get it to work correctly a "Wait" action is needed before it.

IMG_0155

Without a such delay, the action returns a state that is preceding the switching. I believe this happens due to delays in the propagation of the state to apps. Currently, a delay using the "Wait" action is a solution but it's unnecessarily long and pretty notable when automation is running.

Personally, I see two options here:

1) introduce a new separate action to have sub-second delays for putting it before the "Is Low Power Mode On" action 2) add a delay option into the "Is Low Power Mode On" action itself, so the user can set a delay of 200 or 300 msec.

I would prefer to have an option as a part of the "Is Low Power Mode On" action as it's connected to how the iOS delivers state changes to apps. If this is a known and expected system behavior, the user then needs a hint about it and an option inside the action to avoid it without bringing an additional action.

Would be nice to hear alternative ideas or perhaps a better solution.

Thank you.


Actions 2.5.2 (42) - com.sindresorhus.Actions iOS 16.5.1 iPhone14,2

sindresorhus commented 1 year ago

In Actions 2.6.0, there is a Wait Milliseconds action. Can you try using it and experiment with what the lowest possible wait is?

frkd-dev commented 1 year ago

Installed the update. By experiment I narrowed down to 20ms with a new “wait ms” action. Ten ms also works but unreliable: ≈¼ of all switches are failing. Set 5 ms and automation fails just randomly.

I’ve stopped at 30 ms as it seems timings are floating to some extent so 20 ms also may have rare misses, although I didn't see them so far. This 30ms is far less I can spot by naked eye as it equals to 2 screen refreshes at 60Hz or 4 at 120 Hz.

sindresorhus commented 1 year ago

Thanks for testing. I'll add a 30ms delay in the next update.

frkd-dev commented 1 year ago

Are you going to make it configurable in action’s UI? I’m asking because I have doubts this delay is the same across devices of different generations.

sindresorhus commented 1 year ago

No. I want to keep it simple. If it doesn't work for other people, they can use the Wait Milliseconds action themselves.