Hue Sync Box Mode

I was also struggling with controlling the Hue Play Sync Box from Homey. I’ve asked Athom for an update of the app a year ago but unfortunately nothing has changed since then.

Let me share my workaround, which allows me to set the sync mode like this:

Step 1: Obtain an access token

Before you can control or read data from the Hue Play Sync Box, you need to pair with it and create credentials. This only needs to be done once. After you obtain the accessToken, you can reuse it forever (until you remove the registration).

  1. Make sure the Sync Box is on
  2. Make sure synchronization is stopped
  3. Make an HTTP POST request to:
    https://<SYNC-BOX-IP>/api/v1/registrations
  4. Use this JSON body:
    { "appName": "homey", "instanceName": "homey" }
  5. The first response will be:
    { "code": 16, "message": "Invalid State" }
  6. Within 5 seconds, press and hold the Sync Box button until the LED turns green
  7. Release immediately when it turns green (it will go white again)
  8. Within 5 seconds, send the same POST request again
  9. The response now contains the accessToken (your Bearer token)

Step 2: Creating a reusable script to set the Sync Box mode

  • Open the Homey Web App, go to HomeyScript and click New HomeyScript
  • Name the script: SetPhilipsHueSyncBoxMode
  • Paste the following content into the script editor
    • Replace [SYNC-BOX-IP] with your Sync Box IP
    • Replace [ACCESS-TOKEN-HERE] with your access token
  • Click Save
// Set Mode for Philips Hue Sync Box

// Argument value: powersave, passthrough, video, game, music, ambient

const syncboxIp = "[SYNC-BOX-IP]";
const bearerToken = "[ACCESS-TOKEN-HERE]";

const url = `https://${syncboxIp}/api/v1/execution`;
const mode = args[0];
const body = JSON.stringify({ mode });

const agent = new https.Agent({ rejectUnauthorized: false });
const response = await fetch(url, {
  method: "PUT",
  agent,
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${bearerToken}`
  },
  body
});

if (!response.ok) {
  throw new Error(`SyncBox returned ${response.status} ${response.statusText}`);
}

Note: The default Request action card validates SSL certificates and will not work with the Sync Box’s self-signed certificate. That’s why we use HomeyScript instead.

Step 3: Set the sync mode via a flow

  • Add a new Then… card
  • Choose HomeyScript
  • Select Execute script with argument (not “Execute code”)
  • In the dropdown, select SetPhilipsHueSyncBoxMode
  • In the argument field, enter the desired mode:
    • powersave
    • video
    • game
    • music