How I Control My Sony TV From Claude Code
My Sony TV thought it lived in America. I wanted the menus in English, but I wanted the TV to know it is in Japan, because the Japanese streaming app I was after would not show up. The settings menu offers English (United States) or Japanese, and nothing in between.
So I asked Claude Code to fix it from my Mac, over the wifi. It found the TV, read its settings, changed the region, rebooted it, and then installed the app the Play Store had refused me. The only time I picked up the remote was to turn on one setting and approve one dialog.
You can do the same with any Sony BRAVIA running Google TV or Android TV, and with most other TVs built on Android.
What Claude can reach without touching anything
Start by asking Claude to find the TV. You do not need its IP address. A prompt like this is enough:
Find my TV on the local network. Look at mDNS and SSDP, tell me the
brand, model and IP, and what control interfaces it exposes.
A BRAVIA announces itself in several ways at once: as a Chromecast target, as an AirPlay receiver, as an Android TV remote, and through Sony's own discovery. Claude browses those services with the tools already on a Mac, like dns-sd, and comes back with the model number and the address in a few seconds.
Sony TVs also run a small web API on the TV itself. Without any pairing it answers a few harmless questions: the model, whether the screen is on, the current time. Everything that changes the TV needs a PIN or a key you set on the TV. The Chromecast side tells you one more useful thing, which locale and country the TV thinks it is in. Mine said en-US and US.
Reading is as far as you get without changing a setting on the TV. Driving it takes one switch.
Turn on ADB debugging
ADB is the Android debug bridge, the same tool app developers use to talk to a phone. Google TV is Android underneath, so the TV speaks it too. Turning it on takes a minute with the remote:
- Settings, System, About. Select the Android TV OS build line seven times until the TV says you are a developer.
- Settings, System, Developer options. Turn on USB debugging. On a Sony this also opens debugging over the network.
- Tell Claude it is on. It runs
adb connectwith the TV's address, and the TV shows a dialog asking whether to allow this computer. Tick always allow and press OK.
That dialog is what keeps this safe. Nothing on your network can control the TV until you approve that specific computer on the screen.
Once it is approved, Claude has what it needs to work like a person with a remote, except it can also read the screen:
adb exec-out screencap -ptakes a screenshot, so Claude can see what is on the TV before and after every step.uiautomator dumplists every label and button on screen, with its position, so it does not have to guess where things are.input keyeventpresses remote buttons: up, down, OK, back, home.am startopens any screen or app directly, including a Play Store page.
English menus, Japanese region
Android stores language and region together as one locale, like en-US or ja-JP. The TV's language list only offers the combinations Sony decided to ship. The system itself accepts any valid locale, including en-JP: English text, Japan as the country.
There is no shell command for it on Android 12, so Claude wrote one. It is a tiny Java program, compiled on the Mac with the Android SDK, pushed to the TV and run with app_process. That runs it as the shell user, which is allowed to change the system configuration:
Object am = Class.forName("android.app.ActivityManager")
.getMethod("getService").invoke(null);
Configuration c = (Configuration) am.getClass()
.getMethod("getConfiguration").invoke(am);
c.setLocales(LocaleList.forLanguageTags("en-JP"));
Configuration.class.getField("userSetLocale").setBoolean(c, true);
am.getClass().getMethod("updatePersistentConfiguration",
Configuration.class).invoke(am, c);
Claude ran it once in read only mode to print the current locale, then for real, then rebooted the TV and checked that en-JP survived the restart. Menus stayed in English. Running it again with en-US puts everything back.
You do not need to write this yourself. Ask for the outcome:
The TV is connected over ADB. Set the system locale to English with
Japan as the region, without changing the menu language. Show me the
locale before and after, reboot, and confirm it stuck.
Installing an app the store says you cannot have
The app I wanted was SKY PerfecTV's streaming app. The new region did not unlock it on its own. Claude opened its Play Store page on the TV and took a screenshot: this item is not available in your country.
That message has nothing to do with the TV. The Play Store country belongs to your Google account, and it does not follow the TV's region or your IP address. Claude checked the places you would expect to change it. The Play Store website has no country setting, and neither does the Play Store on the TV.
The only place it can change is the Play Store app on an Android phone signed into the same account: Settings, General, Account and device preferences, Country and profiles. It only lists countries where you have a Google payments profile, and Google lets you switch about once a year, so it is worth doing on purpose.
I signed in to an old Android phone, plugged it into the Mac, and Claude drove the phone over ADB the same way it drove the TV. The phone had two Google accounts and the Play Store opened on the other one, so Claude switched accounts before touching the country. I would not have noticed. After the switch it closed the Play Store on the TV so it would reload the new country, opened the app page again, and this time there was an Install button. It pressed it, waited, and the button turned into Open.
Where it stopped and asked
The part I liked most was where Claude did not just keep going.
It never turned on anything that loosens security by itself. It gave me the steps for the remote instead of hunting for a workaround. Before the Play country switch it told me the change is locked for a year and waited for my yes. And when the new app opened on a privacy policy with an agree button, it stopped and asked me, because agreeing to terms is my decision, not a step in a script.
If you set this up, keep the same lines. Let it read, look and navigate freely. Make it ask before anything that agrees, buys, deletes or cannot be undone.
Clean up when you are done
ADB gives an approved computer full control of the TV. That is the point, but you probably do not want it on forever. When you are finished, turn USB debugging off in Developer options, or ask Claude to do it as its last step. The locale change stays either way.
What surprised me is how ordinary it felt. I did not install a special app or buy a smart home hub. The TV was already speaking three or four protocols on my network, and Claude simply read them one at a time until one let it in.