Hue Essentials Sync Mode on Android TV Automation

I wanted to setup an automation to turn on Sync mode when I activate my Movie Mode automation in Home Assistant and really struggled. I eventually got it to work another and thought this might help others. If anyone has advice on how to clean it up, I would greatly appreciate it.

It all worked perfectly manual, I’ve been using it like that for a year or so. I have one strip of lights, a Hue bridge, and Hue Essentials premium installed on a Sony Android TV. I can turn on sync mode and it will read from the TV as expected.

First I tried to automate it with the help of the intents in the docs and Claude Code, but wasn’t successful. It looked like there was an issue with sending the wrong GROUP_ID. Every time I ran the script it would wipe which entertainment area was selected. I couldn’t seem to find the correct group ID within the app. Claude tried to find out what it should be with some adb commands and came back saying it wasn’t possible. I have a feeling I’m missing something.

The deeper problem is that Hue Essentials stores the bridge internally with its own privately-generated UUID (in a SQLite DB you can’t read without root), and the BRIDGE_ID in the intent has to match that UUID, not the hardware ID shown in the Hue app. There’s no way to retrieve it externally. The GROUP_ID being wrong was secondary — the BRIDGE_ID mismatch is why it can never work on a non-rooted device, even if you find the right group ID.

After these difficulties, I had it automate the steps I would take manually to make it work, programmatically navigating the menus as a user would. It’s not clean or smooth, but it worked.

Original attempt:

am start -n com.superthomaslab.hueessentials/.MainActivity
am broadcast -a com.superthomaslab.hueessentials.START_ENTERTAINMENT \
  -e BRIDGE_ID ecb5fafffebbeeda \
  -e GROUP_ID 200 \
  -e ENTERTAINMENT_PROGRAM sync \
  com.superthomaslab.hueessentials

What worked:

1. If TV is off → turn on, wait 15s
2. `am force-stop com.superthomaslab.hueessentials` — ensure clean app state
3. Wait 500ms
4. `am start -n com.superthomaslab.hueessentials/.MainActivity`
5. Wait 4s — app startup
6. `DPAD_DOWN DPAD_DOWN DPAD_CENTER` (300ms between each) — left nav: Home → Devices → Entertainment, enter
7. `DPAD_RIGHT DPAD_RIGHT DPAD_CENTER` (300ms between each) — move to Sync card, open it
8. Wait 300ms → `DPAD_CENTER` — press START
9. Wait 1s → `DPAD_CENTER` — confirm MediaProjection screen recording dialog
10. Wait 500ms → go back to home