Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
ISO/IEC 29341-4-10:2011 defines the UPnP Scheduling Service, a standardized service for managing scheduled events and recurring tasks within a UPnP network environment. This service enables devices and control points to create, modify, delete, and query scheduled actions — from simple one-shot timers to complex recurring schedules with multiple constraints. The Scheduling Service brings deterministic time-based automation to UPnP networks, making it possible to build smart home and building automation systems that execute actions at specified times or intervals without requiring a continuously connected control point.
The Scheduling Service is identified by the service type urn:schemas-upnp-org:service:Scheduling:1. It provides a rich set of capabilities beyond simple timer functionality: schedules can be defined with recurrence rules (daily, weekly, monthly, or custom intervals), validity ranges (start and end dates), and exception dates (holidays or maintenance periods where the schedule should be skipped). This level of flexibility makes the service suitable for applications ranging from HVAC system programming to lighting automation and media recording schedules.
Each schedule in the Scheduling Service is identified by a unique Schedule ID and comprises several properties: the schedule type (one-shot, daily, weekly, monthly, or custom), the target action (the UPnP action to be invoked when the schedule triggers), time specification (absolute time or offset from midnight), recurrence rule (following the iCalendar RRULE syntax), and validity period (start and end date/time). The service stores these schedules in non-volatile memory and evaluates them against the current time, triggering the associated action when a schedule becomes due.
| Property | Data Type | Example |
|---|---|---|
| ScheduleID | string (UUID) | “urn:uuid:a1b2c3d4-…” |
| ScheduleType | string | “WEEKLY” |
| TargetDevice | string (UDN) | “uuid:device-001” |
| TargetAction | string | “SetTarget” |
| TargetArguments | XML | “<args><newTargetValue>1</newTargetValue></args>” |
| RecurrenceRule | string (iCalendar RRULE) | “FREQ=WEEKLY;BYDAY=MO,WE,FR” |
| ValidityPeriod | string (ISO 8601 range) | “20260101T000000/20261231T235959” |
The scheduling engine inside the service evaluates schedules on a periodic tick (typically every 60 seconds, though the standard allows implementation-specific intervals). When a schedule fires, the service invokes the specified action on the target device using UPnP control messaging. If the target device is offline or the action fails, the service can optionally retry the action based on a configurable retry policy. The standard defines a ScheduleFired event that notifies subscribed control points each time a schedule triggers, enabling logging and auditing of automated actions.
The service also provides actions for managing schedules: CreateSchedule, UpdateSchedule, DeleteSchedule, GetSchedule, and GetSchedules. These actions accept schedule definitions in XML format and return the schedule ID upon successful creation. When updating a schedule, the service atomically replaces all properties of the existing schedule — there is no partial update mechanism, so the control point must read the current schedule, modify the desired fields, and write back the complete definition. This design simplifies the implementation but places the burden of consistency on the control point. The GetSchedules action can optionally filter by device UDN or service type, allowing a control point to retrieve only the schedules relevant to a specific device or function.
Implementing the Scheduling Service on embedded devices presents several unique challenges. Non-volatile storage management is paramount — flash memory has limited write cycles, and schedules can change frequently (users adding, modifying, or deleting schedules). Implement a wear-leveling strategy: batch schedule changes into a transaction log and commit them to flash periodically rather than rewriting the entire schedule database on every modification. Use a checksum or CRC to detect corruption from unexpected power loss during writes.
Time zone and DST handling is another critical consideration. The Scheduling Service stores times in local time, but embedded devices often run on UTC internally. The implementation must translate between UTC and local time when evaluating schedules, and crucially, must handle Daylight Saving Time transitions correctly. When a DST spring-forward occurs, schedules that fall in the skipped hour should be executed immediately before the transition. During fall-back, schedules in the repeated hour should only fire once unless intentionally designed to fire twice. Handle internationalization by accepting IANA timezone database identifiers (e.g., “America/New_York”) as part of the schedule definition, enabling schedules to work correctly across different geographical regions.
For conflict resolution, when multiple schedules target the same device at the same time, the standard does not mandate a specific priority scheme. The recommended approach is to execute all matching schedules in order of creation timestamp (FIFO). If the target action is idempotent (e.g., setting a target value), this is safe. For non-idempotent actions, implementors should provide a priority field extension or require the control point to manage dependencies through schedule ordering. Another practical concern is schedule overlap detection — the service can optionally warn control points during CreateSchedule or UpdateSchedule if the new schedule overlaps with an existing one for the same target device, helping users avoid unintended conflicts.
UpdateSchedule and DeleteSchedule actions do not affect a currently executing action. If the schedule triggers again after modification, the new parameters apply from the next firing.ValidityPeriod has a reasonable range (1 year maximum recommended) to prevent unbounded schedule tables.