braviawrap
v1.0.10
Published
TypeScript Wrapper for Sony Bravia REST API
Readme
braviaWrap
TypeScript wrapper for the Sony Bravia REST API
Why Tho?
My TV remote sucks, and I just found out my TV has API support.
I'm just a girl who wants a dedicated Plex button, is that so much to ask?
Usage
This is what you're here for.
import { bravia } from "./braviawrap/bravia.ts";
var mytv = new bravia("tvIP","tvPSK"); //PSK optional for some models!
console.log(await mytv.system.getCurrentTime());Output:
{
result: [
{
dateTime: '2025-08-07T07:02:27-0400',
timeZoneOffsetMinute: -300,
dstOffsetMinute: 60
}
],
id: 1
}
Bravia displays which are not in "PRO MODE" may lack a few features and authentication methods.
If your Bravia has GoogleTV instead of AndroidTV, you can not enable it.
Note: To actually turn on the TV you need to enable Wake On Lan or keep the TV from sleeping with USB power settings.
Detailed Usage (usage but boring)
The Bravia API is split into several "services":
[guide, appControl, audio, avContent, encryption, system, video, videoScreen]
Within these services, there are methods.
Ex:
System contains: getCurrentTime, setPowerStatus, etc.
Audio contains: getSoundSettings, setAudioVolume, etc.
After creating a "bravia" instance, you may use most methods as follows:
await braviaInst.serviceName.methodName();Each method returns some response in JSON, including the "result" and "id" elements:
{
result: [
{
dateTime: '2025-08-07T05:33:20-0400',
timeZoneOffsetMinute: -300,
dstOffsetMinute: 60
}
],
id: 1
}OR an error:
{ error: [ 3, 'Illegal Argument' ], id: 1 }Finally:
Resources
Here is a list of every Bravia API error code.
Here is the landing page for the Bravia REST API, which lists every service and method.
They even have a little demo html file you can download.
PLEASE NOTE
The Bravia API docs have some typos, and some examples which I suspect may be outdated. Additionally, because it seems imperfectly maintained, it just sort of straight up lies sometimes.
Ex: getTextForm (v1.1) falsely claims that you may request data without encryption. As far as I can tell, it seems that this was changed when moving from version 1.0 to 1.1. Part of the page is right, but it's waaaay at the bottom and very vague. I figure there's probably more stuff like that I haven't found yet.
// This is my first TypeScript project, so beware!
// This is also my first anything project in a while, so double beware!
