Skip to main content

Automate Headset Actions with the ArborXR CLI

Use ArborXR CLI automations, run from your own computer, to act on your headsets automatically: launch an app when another opens, reopen ArborXR Home from the Meta home screen, or reboot headsets on a schedule.

Written by Peter Peterson

Who can use this feature?

👤 Anyone with a Personal Access Token whose role can view devices and groups and remotely launch apps (or reboot headsets, for the reboot task). Organization Owners and Admins can.

🚩 Available on the Essential, Classroom Pro, Classroom Ultimate, and Enterprise plans.

🧰 Requires the ArborXR CLI 1.1.0 or later.

Overview

Automations are “when this happens, do that” rules for your headsets, run by the ArborXR CLI on a computer you choose. For example, an automation can:

  • Open ArborXR Home on any headset that's sitting on the Meta home screen.

  • Launch a companion app whenever a training app opens.

  • Reboot a group of headsets every night.

You write your automations in a YAML file. The CLI checks your headsets through the ArborXR API every few seconds and acts on the ones a rule applies to. You can run it continuously, or one run at a time from a scheduler.

⚠️ Automations run on your computer, not in ArborXR.

The CLI does the checking and sends the actions, so automations only work while it's running on a computer that's on, awake and connected to the internet. If that computer sleeps, shuts down or loses its connection, or the CLI is closed, nothing happens: ArborXR doesn't run automations on its own. Anything that happens in the meantime isn't caught up on later; when the CLI starts again, it acts on headsets as they are at that moment.

Run it on a computer that stays on, such as a desktop or a server, not a laptop that gets closed or taken home.

This article walks through setting up and running automations. The ArborXR CLI documentation in the Developer Center has the complete reference for every trigger, task and setting.


Before You Start

  1. Install Python 3.9 or later from python.org, then install the CLI:

    pip install --upgrade abxrcli
  2. Check it worked: abxr-cli -v should show version 1.1.0 or later. On Windows, if abxr-cli isn't recognized, use py -m abxr.cli in its place.

  3. Generate a Personal Access Token in the ArborXR portal under Settings > Access & Security > Access Tokens. See Access Tokens for step-by-step instructions.

  4. Give the token to the CLI in your terminal. In Windows PowerShell:

    $env:ABXR_API_TOKEN = "your-token"
  5. On macOS or Linux:

    export ABXR_API_TOKEN="your-token"
  6. Check the CLI can reach your organization: abxr-cli org info shows its name.

See CLI Tool for more about installing and using the CLI.


Steps to Write an Automations File

  1. Create a plain text file, for example automations.yml, in a plain text editor (Notepad on Windows, TextEdit in plain text mode on a Mac). Indent with spaces, not tabs.

  2. Add your automations. This one opens ArborXR Home on any headset in a group that's on the Meta home screen:

    interval: 15
    automations:
      - name: Open ArborXR Home when a headset is on the Meta home screen
        when:
          foreground_app: com.oculus.vrshell
        then:
          launch_app: app.xrdm.launcher
        retry_after: 60
        targets:
          groups:
            - <group ID>
  3. Replace <group ID> with your group's ID. To find it, open the group in the ArborXR portal: the ID is the part of the address after /group/. A group includes its subgroups.

Each automation has these settings:

Setting

What it does

name

A unique name, shown in the log.

when

Optional. The trigger (below). Without it, the task is done on every targeted headset each run, which needs --once.

then

The task (below).

targets

Which headsets: organization: true, or groups and/or devices, each a list of IDs. A group includes its subgroups.

retry_after

Optional. Do the task again if the trigger still holds this many seconds after the last try (at least 15).

enabled

Optional. Set to false to turn an automation off.

At the top of the file, interval sets the seconds between checks (default 15, at least 5). See Configuration file in the CLI docs for every setting.

Triggers

Trigger

Holds while

Example

foreground_app

An app, by package name, is in the foreground

foreground_app: com.acme.trainer

battery_below

The battery is below a percentage (1 to 100)

battery_below: 20

No when

Always: the task is done on every targeted headset each run

Newer versions of the CLI add more triggers and tasks. See the full list in the CLI docs.

Tasks

Task

Does

Example

launch_app

Launches an app by package name. Add quit_current_app: true to close the current app first.

launch_app: com.acme.companion

reboot

Reboots the headset.

reboot: true


Steps to Run Automations

Try it first

A dry run checks your headsets once and logs what each automation would do, without doing anything:

abxr-cli automations run automations.yml --once --dry-run

Run continuously

Run this on a computer that stays on and awake, and leave the window open. Press Ctrl+C to stop:

abxr-cli automations run automations.yml

Automations stop as soon as this window is closed or the computer sleeps or shuts down, and only start again when you run the command again.

Each time an automation acts, the CLI logs a line, such as:

[Open ArborXR Home when a headset is on the Meta home screen] Room 4 Quest (2G0YC1ABCDEFGH) opened com.oculus.vrshell; launch app.xrdm.launcher: done

To keep a log file as well, add | tee -a automations.log on macOS or Linux, or | Tee-Object automations.log -Append in Windows PowerShell.

Run on a schedule

With --once, the CLI checks once and exits, so a scheduler such as cron, Windows Task Scheduler or a CI system can decide when it runs. An automation without when acts on every targeted headset each run, for example a nightly reboot:

automations:
  - name: Nightly reboot
    then:
      reboot: true
    targets:
      groups:
        - <group ID>
0 2 * * * abxr-cli automations run /path/to/nightly.yml --once

The scheduler needs ABXR_API_TOKEN set; in a CI system, store it as a secret. The computer running the scheduler has to be on at the scheduled time, or that run usually doesn't happen. Schedulers can also start runs late, so this suits “around 2am” rather than “exactly 2:00”.

See Long-running or scheduled and Running automations in the CLI docs for more.


How Automations Decide When to Act

  • Running continuously, a trigger is an event: an automation acts when a headset starts to meet it, such as just opening the app, and not again until the headset has stopped meeting it and starts again. Headsets that already meet it when the CLI starts count as just starting.

  • Running with --once, a trigger is a condition: the automation acts on every targeted headset that meets it at that moment.

  • Only online headsets count. An offline headset keeps its last state.

  • If ArborXR refuses a task, for example a launch on a headset in ArborXR Kiosk Mode, the refusal is logged and not retried until the trigger fires again.

  • With retry_after, a task that was done but didn't take effect (such as a launch sent while a headset was still starting up) is done again while the trigger still holds.

  • Automations act on any one headset at most 5 times in 10 minutes, so two automations can't set each other off in a loop.

See In both modes in the CLI docs for the details.

Limitations

  • ArborXR doesn't run automations itself. They only run while the CLI is running on your computer, and nothing is caught up on while it's stopped.

  • The CLI checks every few seconds, so a headset that leaves an app and comes back between two checks isn't noticed.

  • Restarting a continuous run acts again on headsets that already meet a trigger.

  • Each check lists every headset in your organization, so larger organizations make more API requests per check.

See Limitations in the CLI docs.


Troubleshooting

You see

What to do

Unauthorized: Invalid API Token.

The token isn't set in this terminal window, or was copied incorrectly. Set ABXR_API_TOKEN again.

group(s) not found in this organization

A group ID in the file is wrong. Check it in the portal's address bar.

refused: 422 Cannot remote launch while in ArborXR Kiosk Mode.

The headset uses ArborXR Kiosk Mode, where apps can't be launched remotely.

skipped, automations already acted on this device 5 times in the last 10 minutes

The safety limit. The headset keeps meeting the trigger again; check what's sending it back.

has no when:, so a long-running run would act on each device only once

Run that file with --once from a scheduler.

An error naming a place in the file, such as automation 'A': when: ...

The file has a typo or an unknown setting. Fix the part it names.


Related Articles

I want to...

Read

Install the CLI and upload app builds

Generate an access token

Use the v3 API directly

See every automation trigger, task and setting

See every CLI command and option

Did this answer your question?