Skip to content

Add Set Sleep Timer and Cancel Sleep Timer Tasker commands - #6400

Open
officialasishkumar wants to merge 2 commits into
Automattic:mainfrom
officialasishkumar:add/tasker-sleep-timer
Open

officialasishkumar wants to merge 2 commits into
Automattic:mainfrom
officialasishkumar:add/tasker-sleep-timer

Conversation

@officialasishkumar

Copy link
Copy Markdown

Description

Tasker's Control Playback action can skip, change speed, trim silence and boost volume, but it can't touch the sleep timer, so automations like "start a 15 minute sleep timer whenever a podcast starts after 10pm" aren't possible.

This adds two commands to Control Playback:

  • Set Sleep Timer: takes a new Sleep Timer (Minutes) input and calls SleepTimer.sleepAfter, the same call the player's sleep timer sheet makes. It replaces any end of episode or end of chapter timer that was running. A missing, non-numeric, zero or negative value returns a Tasker error rather than being ignored.
  • Cancel Sleep Timer: stops whichever sleep timer is running.

SleepTimer is now available to the plugin through TaskerEntryPoint.

The Tasker plugin module had no unit tests, so I added Robolectric test support (with the same sdk=35 robolectric.properties the other modules use) and a small shim Application that serves TaskerEntryPoint. The new tests run ActionRunnerControlPlayback against a real SleepTimer.

Fixes #3270

Testing Instructions

Unit tests: ./gradlew :modules:features:taskerplugin:testDebugUnitTest

Manual:

  1. In Tasker, create a task with the Pocket Casts Control Playback action.
  2. Pick the Set Sleep Timer command. Only the Sleep Timer (Minutes) field should appear. Enter 15.
  3. Start playing an episode and run the task.
  4. Open the full-screen player. The sleep timer should be running with about 15 minutes left.
  5. Add another Control Playback action with Cancel Sleep Timer and run it. The sleep timer should stop.
  6. Run Set Sleep Timer with abc or 0. Tasker should report the error "Sleep timer minutes … not valid".

Screenshots or Screencast

N/A

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the Event Horizon schema to reflect any new or changed analytics.

No Compose components or analytics were added or changed. The new input field uses the existing Tasker config screen.

The Tasker "Control Playback" action could skip, change speed, trim
silence and boost volume, but had no way to start or stop the sleep
timer, so automations such as "start a 15 minute sleep timer whenever
a podcast starts after 10pm" were not possible.

Add two new playback commands:

- Set Sleep Timer: takes a "Sleep Timer (Minutes)" input and starts
  the timer through SleepTimer.sleepAfter, the same call the player's
  sleep timer sheet uses. It replaces any end of episode or end of
  chapter timer. Missing, non-numeric or non-positive values return a
  Tasker error instead of being ignored.
- Cancel Sleep Timer: stops whichever sleep timer is running.

SleepTimer is exposed to the plugin through TaskerEntryPoint.

The Tasker plugin module had no unit tests, so add Robolectric test
support and a small shim Application that serves the entry point, and
cover the new commands by running ActionRunnerControlPlayback against
a real SleepTimer.
@officialasishkumar
officialasishkumar requested a review from a team as a code owner November 11, 2026 14:02
@officialasishkumar
officialasishkumar requested review from geekygecko and removed request for a team November 11, 2026 14:02
@CLAassistant

CLAassistant commented Nov 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-11T14:02:06.966620Z
We couldn’t complete this review. Comment @codex review to try again.
d190c0c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Sleep Timer to Tasker Intent

2 participants