Aller au contenu

Modèle Timer

Un minuteur dont le cycle de vie est géré par le serveur : envoyez un seul push de démarrage, et le serveur déclenche lui-même les mises à jour d'avertissement et de fin.

Démonstration d'activité en direct

Fields

FieldTypeDescription
templatestringRequired. "timer", or "countdown", the template's original name. Both are accepted; responses and pushes report "countdown"
progressfloatInitial progress (usually 0.0); the completion push sets 1.0
durationstringRequired (or end_date). Server-side convenience — converted to end_date before reaching the device. Accepts: "30s", "5m", "1h30m", or plain seconds ("1500")
end_dateintegerRequired (or duration). Unix timestamp when the countdown expires
start_dateintegerUnix timestamp when the countdown began. Must be less than end_date. Used to compute progress on-device.
warning_thresholdintegerSeconds before end_date to send a warning push (accent turns orange)
completion_messagestringText shown when countdown expires (default: "Completed")
statestringStatus text (e.g. "Baking", "Printing")
iconstringSF Symbol name or MDI icon with mdi: prefix (e.g. "mdi:timer-outline")
subtitlestringSecondary text
accent_colorstringNamed color or hex
background_colorstringBackground color override
text_colorstringText color override
alarmbooleanOpt-in: schedule an iOS AlarmKit alarm at end_date that rings through silent mode and Focus, with built-in Dismiss and Snooze. iOS 26+ only. Persists across partial updates until cleared with alarm: null or a transition to ended — see Alarms.
snooze_secondsintegerHow long the alarm's Snooze button defers the alarm, in seconds (60–3600). Defaults to 300 (5 minutes).
Bientôt dans la version 1.14.0 de l'app
Bientôt dans la version 1.19.0 de l'app

Accepts url_action, secondary_url_action, and tap_action — tap_action is useful for deep-linking back into the timer's source app while it runs. See Tap actions.

Example Payload

Démarrer un compte à rebours
{
  "state": "ongoing",
  "content": {
    "template": "timer",
    "progress": 0.0,
    "state": "Baking",
    "icon": "flame",
    "subtitle": "25 min timer",
    "duration": "25m",
    "warning_threshold": 60,
    "completion_message": "Done baking!",
    "accent_color": "orange",
    "alarm": true
  }
}

Auto-Managed Lifecycle

After the start push the server manages the remaining lifecycle, in this order; the timer display itself is computed on-device from start_date and end_date, so it counts down in real time without additional pushes.

PhaseTriggerWhat the server sends
StartYour pushNothing -- your update sets ended -> ongoing with the countdown content
Warningwarning_threshold seconds remainAn update with accent_color: "orange", automatically
Completionend_date reachedAn end push with completion_message and progress: 1.0
Bientôt dans la version 1.19.0 de l'app

Cette section décrit une fonctionnalité d'une mise à jour de l'app en attente de validation par l'App Store. Elle se déverrouille ici automatiquement dès que la mise à jour est disponible.