Skip to main content
A device runs one action at a time. Use onConflict to decide what happens when you push while another action still holds the device.

What counts as a conflict

An action on the same device that is scheduled or acknowledged, or a windowed action whose window is still running, even if it’s completed. Time windows aren’t compared, so two scheduled actions with separate windows still conflict. cancelled actions, and finished actions with no window still running, never conflict.

Strategies

A replaced scheduled action moves to cancelled. A replaced window that is already running keeps its state, and your action takes over the device.

Supported strategies

Each device lists the strategies it supports in conflictStrategies on its read response.
Sending a strategy the device doesn’t list returns 422 DEVICE_NOT_CAPABLE with requestedStrategy and supportedStrategies in details, even when there’s no conflict. Many devices list cancel_and_replace only.

The 409 response

details.strategies lists what will resolve it. Resend with one of them. conflictingActionIds is always an array.

How queue_after works

The existing action must have an end. Your action is created as scheduled and starts at that end. If your start is already later, it’s kept. A windowed push can’t be moved, because its times are fixed. If the existing action ends after your window opens, you get 422 INVALID_TIME_WINDOW with details.reason: "queue_after_overlaps_window". Use cancel_and_replace or pick a later window. You also can’t queue behind an auto.* command, because its end isn’t a time the device is busy until. That returns 422 DEVICE_NOT_CAPABLE.

Conflicts on the device

Some conflicts come from the device rather than from Amps. These are also 409s. SCHEDULER_ACTIVE can be returned when you submit a windowed battery push that overlaps the device’s own schedule. It can also arrive later as the errorCode on a failed action, because the device’s schedule can change before your action runs. The other three usually arrive on the failed action.
If recoveryStrategies includes cancel_and_replace, resend with it to overwrite the overlapping entries on the device. Otherwise, ask the end user to clear the schedule in the manufacturer’s app.

Next steps

Cancelling

Cancel a scheduled action by ID.

Scheduling

Set start and end on a push.

Error codes

Every code and its status.