Sony TV (Serial over IP)
Sony BRAVIA and Pro/B2B displays expose an RS-232 control port that speaks Sony's binary Control-S protocol. This driver reaches that port over the network by carrying the serial line through a serial-to-IP gateway — a Global Caché iTach IP2SL, a Brainboxes ES/SW box, a MOXA NPort, or any TCP↔serial adapter. One TV becomes one GEM device, and commands target that device directly; this driver creates no zones of its own. It can still be attached to an AV zone (as the zone's display / volume device).
Control-S frames are short binary packets — for example 8C 00 00 02 01 8F (power on). They are
not text: GEM transmits them as raw bytes and parses the TV's binary replies back into device
attributes. The driver sets up that byte-level handling itself; the one thing to check is that an
older device hasn't been left with a text setting that overrides it — see
Make the binary protocol work.
GEM ships three Sony TV drivers — pick by how the set is reachable:
- Sony BRAVIA TV (HTTP) — modern BRAVIA Android / Google TVs over the REST/IRCC HTTP API with a Pre-Shared Key. Reach for this first for any current networked BRAVIA. See Sony BRAVIA TV (HTTP).
- Sony TV (Simple IP Control) — the older text-based Simple IP Control protocol on TCP 20060, straight to the TV's own IP with no serial adapter. See Sony TV (Simple IP Control).
- Sony TV (Serial over IP) — this driver. The TV's RS-232 Control-S service port carried over a serial-to-IP gateway, for sets with no working network control.
Reach for this driver when the set has an RS-232 control port and no usable network API, and you are wiring that port to a serial gateway. If the set answers on the network (HTTP with a Pre-Shared Key, or Simple IP Control on 20060), prefer one of those drivers — they need no gateway.
What's controlled
- Power —
power_on,power_off, and a Control-S standby-enable command. Aget_powerquery reads the set's power state back into an attribute. - Volume and mute — step the level up/down (
volume_up/volume_down), toggle mute (mute_toggle), and query the current level (get_volume). See Volume and the TV's speakers for how absolute volume behaves. - Inputs — jump straight to HDMI 1–4.
- Navigation — the directional pad,
enter,back,home,info, and the action menu, for driving on-screen menus from a touchpanel. - Status read-back — the TV's volume and power replies are parsed into the
volumeandpower_stateattributes (with the binary transport at its defaults — see below).
Prerequisites
- A Sony BRAVIA / Pro display with an RS-232 control port, with Control-S enabled in the TV's service menu. Many BRAVIA generations leave the RS-232 port dormant until Control-S is turned on there, so the set ignores every frame until you do.
- A serial-to-IP gateway wired to that port and configured for raw TCP at 9600 baud,
8N1. Note the gateway's LAN-side IP and the TCP port mapped to that serial channel (for
example port
4999on an iTach IP2SL). - The gateway reachable from GEM on the same network, with the serial port in raw / transparent TCP mode — not Telnet mode, which inserts protocol bytes that corrupt the binary frames.
Setup
- Wire the TV's RS-232 port to the serial-to-IP gateway (9600 baud, 8N1) and put the gateway's serial channel in raw TCP mode.
- Open Devices, add a device, and choose the Sony TV (Serial over IP) driver. It suggests the AV subsystem and a display device type — accept those.
- Fill in the connection fields:
- Gateway IP (required) — the LAN IP of the serial-to-IP gateway that fronts the TV. This
is not the TV's own IP. Enter the attribute exactly as
ip. - TCP Port (required) — the TCP port on the gateway mapped to the RS-232 channel wired to
the TV (e.g.
4999). Enter the attribute exactly asport.
- Gateway IP (required) — the LAN IP of the serial-to-IP gateway that fronts the TV. This
is not the TV's own IP. Enter the attribute exactly as
- Check Make the binary protocol work below. A new device needs nothing here; a device that carries an Encoding or Response Terminator attribute must have them set as shown, or it connects but no command has any effect.
- Save and enable the device. GEM opens a persistent TCP connection to the gateway and keeps it up, reconnecting automatically if the link drops.
- On the device's Commands tab, run
get_power, thenpower_on/power_offand anhdmi_1to confirm control end-to-end before wiring the TV into macros or a UI.
Make the binary protocol work
Control-S is a binary protocol, so two transport settings decide whether the driver can
transmit its frames and read the TV's replies. The driver defaults both to the right values, so a
device with neither attribute works as-is. A value stored on the device's Attributes tab
overrides the default, though — so if a device carries either attribute (older devices were told to
add them by hand, and a device copied from a text driver may carry utf8), make sure it matches
the table below, then reload the device so the change takes effect.
| Attribute | Must be | Why |
|---|---|---|
encoding | hex | The command frames are space-separated hex bytes. GEM only converts them to the real bytes on the wire — and only turns the TV's byte replies back into a parseable string — when Encoding is hex. The driver defaults to hex; a stored utf8 makes GEM send the characters 8C 00 00 … as plain text, which the TV ignores. |
response_terminator | (blank / empty) | Control-S replies are fixed-length frames with no line terminator. With a terminator set (a carriage return, say), GEM waits for a delimiter that never arrives and never hands the reply to the parser — so volume / power_state never update. Clear the field or delete the attribute. |
utf8 stops everythingIf a device carries an Encoding attribute of utf8, it shows a live TCP connection to the
gateway, yet every command is silently discarded because the hex frames go out as literal text.
Set it to hex (or delete the attribute) and reload the device.
Sending works once Encoding is hex; the Response Terminator must additionally be blank for
the status read-back to populate.
Volume and the TV's speakers
- Stepping (recommended).
volume_upandvolume_downsend the fixed Control-S step frames and are the reliable way to change volume on this driver. Each nudges the level one step. - Mute.
mute_toggleflips mute. This driver has only a toggle — there are no discretemute_on/mute_offcommands, and it does not track a mute state, so drive mute with the toggle. - Absolute volume.
volumetakes a decimalvolumeargument (0–100), records it to thevolumeattribute, and sends the Control-S direct-volume frame8C 00 05 03 01 <level> <checksum>with the level as one hex byte (50 →32). A template you author on the command row takes precedence, and its[volume]token receives the same hex byte. A level that is missing, non-numeric or outside 0–100 is refused. If a particular set ignores direct volume, fall back tovolume_up/volume_down.
If the room's audio comes from the TV's own speakers, make this TV the AV zone's volume device: open AV Zones, edit the zone, and set its Volume Device to this TV so the zone's volume and mute controls drive the set (via the step and toggle commands above). If the room audio instead runs through a receiver, amp, or soundbar, leave that device as the zone's Volume Device and route the TV's own audio away from its speakers, so you aren't fighting two volume controls at once.
Inputs and navigation
- Inputs.
hdmi_1throughhdmi_4jump straight to those HDMI inputs. There is no on-screen "source list" command on this driver — use the specific HDMI commands. - Navigation.
up,down,left,right,enter,back, andhomemap to the matching remote keys;infoshows the info banner andaction_menuopens the action menu. These are handy for driving the TV's on-screen menus from a touchpanel button.
Power and standby
power_onandpower_offsend the Control-S power frames.enable_standbysends the Control-S standby-enable frame — use it if the set needs its network/quick-start standby armed before it will answer a power-on frame from a fully-off state.- If
power_ondoes nothing when the set is fully off, the TV's RS-232 port has powered all the way down. Enable the TV's quick-start / network standby mode (labels vary by model) so the control port stays alive in standby. - Control-S can be turned off again when a firmware update power-cycles the set. If commands stop working after a TV update, re-enable Control-S in the service menu.
Live status feedback
With the binary transport at its defaults (Encoding hex,
Response Terminator blank), the driver parses two reply frames:
- a volume reply → written to the
volumeattribute (0–100); - a power reply → written to the
power_stateattribute (on/off).
Replies carry no terminator, so the driver cuts each one by its own length and checks its checksum byte. A reply split across two network reads, or sharing a read with the answer to an earlier command, is still parsed; a reply whose checksum doesn't add up is ignored rather than written.
The TV also answers every control command with a short acknowledgement. When that answer is a
refusal (any answer code other than 00), GEM writes a warning to the log naming the device and the
answer code. The command itself has already been reported as sent by then, so a refusal shows up
in the log rather than as an error on the command.
Replies don't say which query they answer, so the driver tells them apart by length: a two-byte reply is read as power and a three-byte reply as volume. If you add your own query commands to this device (a mute or input query, for instance), their replies can be mistaken for power or volume.
This driver does not run an automatic background status poll, so those attributes refresh when a
reply actually arrives — for example right after you run get_volume or get_power, or when
the set sends an unsolicited status frame. To keep a touchpanel or a trigger in sync, run the
get_power / get_volume queries on a schedule (a repeating macro or a
timed trigger) or immediately after each control command, rather than
relying on the set to push updates on its own.
Attributes
ip and port are the connection to the gateway. encoding and response_terminator are the
binary-transport settings covered above; the driver's defaults are correct, so only set them to
match those defaults. The status attributes (volume, power_state) are set by
GEM as replies come in — you don't create them by hand, but type them exactly when you reference
them in a trigger or macro.
Device — required
| Attribute | Type | Description |
|---|---|---|
ip | string | LAN IP of the serial-to-IP gateway that fronts the TV (not the TV's own IP). |
port | int | TCP port on that gateway mapped to the RS-232 channel wired to the TV (e.g. 4999). |
Device — binary protocol (defaulted by the driver)
| Attribute | Type | Must be | Description |
|---|---|---|---|
encoding | string | hex | Transmit and parse Control-S frames as raw bytes. The driver defaults to hex; a stored utf8 sends the frames as literal text. |
response_terminator | string | (blank) | The driver defaults to none. Control-S replies carry no terminator, so a stored terminator blocks status parsing. |
Device — status (set automatically)
| Attribute | Type | Description |
|---|---|---|
volume | int | Last reported volume, 0–100. Written from the TV's volume reply frames. |
power_state | string | Last reported power state, on / off. Written from the TV's power reply frames. |
The driver also inherits the standard TCP tuning fields (reconnect timing, command_throttle,
etc.); the defaults suit a TV on a gateway, so leave them alone unless a slow gateway is dropping
back-to-back commands, in which case raise command_throttle.
Commands
Driver-declared commands appear on the device's Commands tab and can be used in macros,
triggers, and on UI buttons. The Sends column is the raw Control-S frame (hex) that goes out on
the wire once Encoding is hex, shown so you can match it against Sony's Control-S reference.
These frames are sent verbatim — the checksum byte is already part of each frame. The one
exception is get_power, whose declared frame is missing its checksum byte; the driver appends it
(81) when it sends the query.
Power
| Command | Sends | Action |
|---|---|---|
power_on | 8C 00 00 02 01 8F | Turn the TV on. |
power_off | 8C 00 00 02 00 8E | Turn the TV off (standby). |
enable_standby | 8C 00 01 02 01 90 | Arm the set's standby-enable so power_on can wake it. |
get_power | 83 00 00 FF FF 81 | Query the current power state → power_state. The command row shows the frame without its final 81; the driver adds it. |
Volume and mute
| Command | Sends | Action |
|---|---|---|
volume_up | 8C 00 05 03 00 00 94 | Step volume up. |
volume_down | 8C 00 05 03 00 01 95 | Step volume down. |
mute_toggle | 8C 00 06 02 00 94 | Toggle mute (no discrete on/off). |
get_volume | 83 00 05 FF FF 86 | Query the current volume → volume. |
volume (arg volume) | 8C 00 05 03 01 <level> <checksum> | Set an absolute level, 0–100, sent as one hex byte. See Volume and the TV's speakers. |
Inputs
| Command | Sends | Action |
|---|---|---|
hdmi_1 | 8C 00 02 03 04 01 96 | Select HDMI 1. |
hdmi_2 | 8C 00 02 03 04 02 97 | Select HDMI 2. |
hdmi_3 | 8C 00 02 03 04 03 98 | Select HDMI 3. |
hdmi_4 | 8C 00 02 03 04 04 99 | Select HDMI 4. |
Navigation
| Command | Sends | Action |
|---|---|---|
up down left right | 8C 00 67 03 01 74/75/34/33 … | Directional pad. |
enter | 8C 00 67 03 01 65 5C | Select. |
back | 8C 00 67 03 97 23 B0 | Back / return. |
home | 8C 00 67 03 01 60 57 | Home menu. |
info | 8C 00 0F 02 00 9D | Show the info banner. |
action_menu | 8C 00 67 03 97 36 C3 | Open the action menu. |
Known limitations and quirks
- Binary transport settings must not be overridden. A stored Encoding other than
hex, or a stored Response Terminator, stops commands or status read-back (see Make the binary protocol work). - Control-S must be enabled on the TV. Many BRAVIA models leave the RS-232 port dormant until Control-S is turned on in the service menu, and a firmware update can switch it back off.
- Absolute volume is unconfirmed on some sets. The
volumecommand sends the Control-S direct-volume frame; if a particular set ignores it, usevolume_up/volume_down. - Refusals are logged, not returned. A command the TV refuses still reports as sent; the refusal appears as a warning in the log.
- Mute is toggle-only. There are no discrete
mute_on/mute_offcommands, and mute state is not tracked; usemute_toggle. - No automatic status poll. Volume and power read back only when a reply arrives — run
get_volume/get_poweron a schedule to keep a touchpanel in sync. - Single device, no zones. A Sony TV is one GEM device; it creates no control zones. Attach it to an AV zone and group multi-room behavior at the AV-zone / macro layer.
Troubleshooting
| Symptom | Check |
|---|---|
| Connects to the gateway, but no command does anything | The device carries an encoding attribute of utf8. Set it to hex (or delete it) and reload the device — the hex frames are otherwise sent as plain text and ignored. |
Commands work, but volume / power_state never update | The device carries a response_terminator attribute. Clear it (or delete it) and reload — Control-S replies have no terminator, so a set terminator blocks parsing. Then run get_power / get_volume — this driver doesn't auto-poll. |
A command does nothing and the log shows sony tv serial command refused | The TV received the frame and declined it — the answer code in the log line says why. Typical causes are a command the model doesn't support, or one sent while the set is still powering up. |
| Nothing connects at all | Confirm the gateway's serial channel is in raw TCP mode (not Telnet), and that Gateway IP / TCP Port point at the serial line — not at the TV's own IP. Confirm the gateway is reachable from GEM. |
| Connects, but the TV never responds | Enable Control-S in the TV's service menu, and confirm the gateway is set to 9600 baud, 8N1. If it worked before and went dead, a firmware update may have disabled Control-S. |
power_on does nothing when the TV is fully off | The RS-232 port powered down with the set. Enable the TV's quick-start / network standby, and use enable_standby so the control port stays alive in standby. |
| Absolute volume set has no effect | Some sets ignore the direct-volume frame. Use volume_up / volume_down, or make the TV the AV zone's Volume Device and drive it with the step commands. |
| Link keeps dropping / reconnecting | Verify only GEM is connected to that gateway port — many serial gateways allow a single TCP client at a time, so a second controller or a stuck session will fight GEM for the port. |
See also
- Sony BRAVIA TV (HTTP) — the modern REST/IRCC BRAVIA driver, commands ready to use.
- Sony TV (Simple IP Control) — text-based Simple IP Control straight to the TV on TCP 20060.
- Global Caché (iTach / Flex / GC-100) — a common serial-to-IP gateway that fronts this driver (Brainboxes and MOXA NPort adapters work the same way).
- AV Zones — attach the TV to a zone and set it as the zone's Volume Device.
- Devices — adding and configuring devices.
- Attributes — editing device attributes such as
encoding. - Commands — running and scripting device commands.
- Triggers — fire automations on the TV's power or volume state.