Skip to content

TV Service

José Antonio Jiménez Campos edited this page May 10, 2020 · 20 revisions

A HomeKit TV service.

Type Device Type
60 TV Service

The following configuration is available for TVs:

Section Key Description
Actions "0", "1" etc. The actions performed by the accessory
Digital Inputs "b" GPIOs that invoke specific actions
State & Status Inputs "f[n]" & "g[n]" Inputs that manage accessory state
ICMP Ping Inputs "q[n]" & "p[n]" Ping inputs that manage accessory state
Accessory Notifications "m" Notifications to send to another accessory
Initial State "s" State a switch accessory enters on boot
Actions on Boot "xa" Enable / Disable execution of accessory actions on boot
TV Input Sources "i" Array of supported TV Inputs e.g. HDMI, DVB etc.

Example

{
  "c":{ "t":14, "p":"J*J*AaAaAaDFAa" },
  "a":[{
    "t":60,
    "xa":0,
    "i":[
      { "n":"MENU", "0":{ "i": [{ "r":2, "c":"CeCfAaBcAaAbC" }] } },
      { "n":"SOURCE", "0":{ "i":[{ "r":2, "c":"CeCeAhG" }] } },
      { "n":"MUTE", "0":{ "i":[{ "r":2,"c":"CeCeDhD" }] } }
    ],
    "0":{ "i":[{ "r":4,"c":"CeCfAfAaF" }] },
    "1":{ "i":[{"r":4,"c":"CeCfAfAaF" }] },
    "6":{ "i":[{ "r":2,"c":"CeCjBaEbA" }] },
    "7":{ "i":[{ "r":2,"c":"CeCeAdBbDbA" }] },
    "8":{ "i":[{ "r":2,"c":"CeCeAaAbBbAaBbA" }] },
    "9":{ "i":[{ "r":2,"c":"CeCfAcBaAaCbA" }] },
    "10":{ "i":[{ "r":2,"c":"CeChAaBaCaAbA" }] },
    "11":{ "i":[{ "r":2,"c":"CeChBaAaCbAaA" }] },
    "13":{ "i":[{ "r":2,"c":"CeCeBaAaBcAaAbA" }] },
    "17":{"i":[{"r":2,"c":"CeCeEhC"}]},
    "22":{"i":[{"r":2,"c":"CeCeChE"}]},
    "23":{"i":[{"r":2,"c":"CeCeBaAfAaD"}]},
    "q0":[{"h":"192.168.1.100","r":0}],
    "q1":[{"h":"192.168.1.100","r":1}]
  },
  {
    "i":0.5,
    "1":{ "s":[{ "a":1 }]}
  }]
}

The above example is a real world example provided by @TriderG75. The example is for a Samsung TV using a universal IR device (such as a Smart Device IR Blaster).

Execution of all actions is disabled while the device boots ("xa:0") to ensure neither the power on or power off action will be triggered on boot.

The example has IR commands for each of the TV Service Actions "0" thru "23" and defines three TV Input Sources; MENU, SOURCE & MUTE.

Refer the the IR Action documentation to see how to set up IR commands to control the TV via the universal IR device.

Additionally in this example the accessory has two ICMP Ping Status inputs defined. The On/Off state of this Samsung Smart TV can determined by pinging the IP address of the TV. If the ping is successful then the TV is on. The Ping Status inputs set the status the TV Power depending on the response from the ping.

This example also shows how a dummy switch can be created to allow the device to enter setup mode by pressing a switch within the HomeKit application: { "i":0.5, "1":{ "s":[{ "a":1 }]} }

TV Input Sources

A TV service can provide multiple TV Input Sources "i". These are the inputs the TV has e.g. HDMI1, HDMI2, USB etc.

The accessory can be configured to have as many TV Input Sources as required to control the TV. TV Input Sources show up within the HomeKit TV App as a scrollable list of inputs that can be selected.

See above example for ways that the TV Input Sources can be configured. Each source "i" definition requires a name ("n") and an action ("0"). The name "n" is a text string. The action "0" can be any action you want to take in order to meet the requirement of the named source, but would normally be an IR defined string ("c") e.g. {"n":"HDMI1","0":{"i":[{"c":"CeCjBaEbA"}]}}

Actions

A TV Service has many actions. See the list below for all the possible actions the HAA TV Service provides.

Key Action Description
"0" Power off Power off the TV (default)
"1" Power on Power on the TV
"6" Arrow up
"7" Arrow down
"8" Arrow left
"9" Arrow right
"10" Select / OK
"11" Back
"13" Play / Pause
"17" Info
"20" No mute
"21" Mute
"22" Volume up
"23" Volume down
"30" Show TV Settings

Accessory Notifications

The list of Accessory Notifications "m" values supported by a TV Service are:

Key Value Notification
"v" 0 Switch OFF (default)
1 Switch ON

See the general Accessory Notifications section for details of how to configure these notifications.

Digital Inputs

Digital Inputs "b" are supported by this accessory.

See Digital Inputs for details on how to define this mandatory option.

State and Status Inputs

State inputs "f[n]" & Status Inputs "g[n]" are supported by this accessory. The supported list is:

Key Action
"f0" Perform action "0" (Off)
"f1" Perform action "1" (On)
"g0" Set accessory state to Off
"g1" Set accessory state to On

Refer to State Inputs for more detail and examples.

ICMP Ping Inputs

ICMP Ping inputs "p[n]" and "q[n]" are supported by this accessory. The supported list is:

Key Action
"p0" Perform action "0" (Off)
"p1" Perform action "1" (On)
"q0" Set accessory state to Off
"q1" Set accessory state to On

Refer to ICMP Ping Inputs for more detail.

Initial State

The Initial State key is supported by this accessory. Refer to Initial State for details of the available values. The initial state that a switch enters on boot can be set using the "s" option.

Clone this wiki locally