Skip to content

RyanSpittler/Vizio_SmartCast_API

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

Vizio SmartCast API (2016+ Models)

Overview

Televisions

  • API Server runs on port 9000 using https. Will not respond to http.

    Don't port forward it. There are some commands that can be executed without authentication.

  • Certificate's CN is BG2.prod.vizio.com so will likely fail SSL validation.

  • API includes a Status object, URI requested, and Execution time on every response. It's included below, but excluded in all of the examples for redundancy.

     {
     	...
     	"STATUS": {
     		"RESULT": String,
     		"DETAIL": String
     	},
     	"URI": String,
     	"TIME": String
     }
    

    API does not seem to be fully restful, and doesn't apply proper status codes in responses. Verify request's result from the status object. Result codes included where applicable.

  • All requests made should contain a JSON body with the header Content-Type: application/json set.

  • When authentication is required, send Auth: AUTH_TOKEN header with request.

  • This does not cover any MyVizio Account APIs.

  • See an issue? Have a question? Open an issue, or find me on twitter @exiva

Sound Bars

According to this forum post from aarondr.

  1. API Server accepts a variety of ports.
    • Port 9001 is the one to use. Responds to http and doesn't require authentication. As the forum post states, it is hosting Django web services in debug mode, so you can use the exception reporting to deduce how to fix your errors.
    • Port 9000 responds to https.
    • Port 10001 is apparently open, but it is unclear what it is used for.
    • Ports 8008 and 8009 are apparently used for Google Casting.
  2. Much of what is found to work was in the restlog that Django provides. Use the SmartCast app on your phone to create requests, then inspect the logs.

curl http://myVizioSoundBarIP:9001/restlog

  1. Unsure if it is necessary, but visiting the version endpoint may have helped force the web services into debug mode.
  2. If you send a request that hangs, you may need to cycle the power to reset the server. Unplugging may be necessary.

Device Discovery

Find IP Address

  1. Lookup the IP Address in the SmartCast app on your phone.

Go to Device Settings > [Device Name] > Network

  1. Perform an SSDP query for ST: urn:schemas-kinoma-com:device:shell:1

Example

M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: urn:schemas-kinoma-com:device:shell:1

Pairing

Required to control television set. Not required for Sound Bars.

Start Pairing

PUT /pairing/start

Body

{
	"DEVICE_NAME": String,
	"DEVICE_ID": String
}

Response

{
	"ITEM": {
		"PAIRING_REQ_TOKEN": Integer,
		"CHALLENGE_TYPE": Integer
	},
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -X PUT -d '{"DEVICE_ID":"12345","DEVICE_NAME":"cURL Example"}' https://myVizioTV:9000/pairing/start

Notes

Save DEVICE_ID, you'll need it for the challenge.

Submit Challenge

PUT /pairing/pair

Body

{
  "DEVICE_ID": String,
  "CHALLENGE_TYPE": Integer,
  "RESPONSE_VALUE": Integer,
  "PAIRING_REQ_TOKEN": Integer  
}

Response

{
	"ITEM": {
		"AUTH_TOKEN": String
	},
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -X PUT -d '{"DEVICE_ID": "12345","CHALLENGE_TYPE": 1,"RESPONSE_VALUE": "1234","PAIRING_REQ_TOKEN": 0}' https://myVizioTV:9000/pairing/pair

Notes

RESPONSE_VALUE key is the code displayed on the TV.

Cancel Pairing

PUT /pairing/cancel

Body

{
  "DEVICE_NAME": String,
  "DEVICE_ID": String
}

Response

{
	"ITEM": {},
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -X PUT -d '{"DEVICE_ID":"12345","DEVICE_NAME":"cURL"}' https://myVizioTV:9000/pairing/cancel

Appendix

Status Results

RESULT Meaning
INVALID_PARAMETER Malformed Request
MAX_CHALLENGES_EXCEEDED Too many failed pair attempts
SUCCESS Successfully Paired
PAIRING_DENIED Incorrect Pin
VALUE_OUT_OF_RANGE Pin out of range
CHALLENGE_INCORRECT Incorrect challenge
BLOCKED Pairing in progress already

Remote Control Methods

Turning Television Set on From Sleep

The HTTP API server turns off when the set is sleeping. Send a WoL magic packet to turn it on. not supported when set runs in Eco mode.

Turning Sound Bar on from Sleep

The HTTP API server keeps running while the sound bar is off. Waking has been found to be unnecessary.

Power State

Authenticated

GET /state/device/power_mode

Response

{
	"ITEMS": [{
		"TYPE": "T_VALUE_V1",
		"CNAME": "power_mode",
		"NAME": "Power Mode",
		"VALUE": 1
	}],
	"PARAMETERS": {
		"HASHONLY": "FALSE",
		"FLAT": "TRUE",
		"HELPTEXT": "FALSE"
	}
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X GET https://myVizioTV:9000/state/device/power_mode

Send remote control button press

Authenticated

PUT /key_command/

Body

{
	"KEYLIST": [{
		"CODESET": Integer,
		"CODE": Integer,
		"ACTION": String
	}]
}

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X PUT -d '{"KEYLIST": [{"CODESET": 5,"CODE": 0,"ACTION":"KEYPRESS"}]}' https://myVizioTV:9000/key_command/

Notes

You can string together long remote actions by adding to the keylist array.

Appendix

Action
KEYDOWN
KEYUP
KEYPRESS
Event Name Codeset Code
Volume Down 5 0
Volume Up 5 1
Mute Off 5 2
Mute On 5 3
Mute Toggle 5 4
Cycle Input 7 1
Channel Down 8 0
Channel Up 8 1
Previous Ch 8 2
Power Off 11 0
Power On 11 1
Power Toggle 11 2

Note: Sound Bars only respond to Codesets 5 and 11. For audio input, see changing inputs below.

Video Input Methods (Televisions)

Get currently selected input

Authenticated

GET /menu_native/dynamic/tv_settings/devices/current_input

Response

{
	"ITEMS": [{
		"NAME": String,
		"CNAME": String,
		"TYPE": String,
		"VALUE": String,
		"ENABLED": Boolean,
		"HASHVAL": Integer
	}],
	"NAME": String,
	"HASHLIST": Array,
	"GROUP": String,
	"PARAMETERS": {
		"HASHONLY": String,
		"FLAT": String,
		"HELPTEXT": String
	},
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X GET https://myVizioTV:9000/menu_native/dynamic/tv_settings/devices/current_input

Get list of inputs

Authenticated

GET /menu_native/dynamic/tv_settings/devices/name_input

Response

{
	"ITEMS": [{
		"NAME": String,
		"CNAME": String,
		"TYPE": String,
		"VALUE": {
			"NAME": String,
			"METADATA": String
		},
		"ENABLED": Boolean,
		"HASHVAL": Integer
	},
	...
	],
	"NAME": String,
	"HASHLIST": Array,
	"GROUP": String,
	"PARAMETERS": {
		"HASHONLY": String,
		"FLAT": String,
		"HELPTEXT": String
	},
	...
}

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X GET https://myVizioTV:9000/menu_native/dynamic/tv_settings/devices/name_input

Change Input

Authenticated

PUT /menu_native/dynamic/tv_settings/devices/current_input

Body

{
	"REQUEST": "MODIFY",
	"VALUE": String,
	"HASHVAL": Integer
}
Expected Values
PUT current_input From name_input
VALUE ITEMS[x].NAME
HASHVAL ITEMS[x].HASHVAL

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X PUT -d '{"REQUEST": "MODIFY","VALUE": "HDMI-1","HASHVAL": 1384176329}' https://myVizioTV:9000/menu_native/dynamic/tv_settings/devices/current_input

Audio Input Settings (Sound Bars)

Get currently selected input

GET /menu_native/dynamic/audio_settings/input/current_input

Response

{
  ...
  "ITEMS": [
    {
      "HASHVAL": Integer,
      "CNAME": String,
      "TYPE": String,
      "NAME": String,
      "VALUE": String
    }
  ],
  "HASHLIST": Array,
  ...
  "PARAMETERS": {
    "FLAT": String,
    "HELPTEXT": String,
    "HASHONLY": String
  }
}

cURL Example

curl -k -H "Content-Type: application/json" -X GET http://myVizioSoundbar:9001/menu_native/dynamic/audio_settings/input/current_input

Get list of inputs

GET /menu_native/dynamic/audio_settings/input

Response

{
  ...
  "HASHLIST": Array,
  "GROUP": String,
  "NAME": String,
  "PARAMETERS": {
    "FLAT": String,
    "HELPTEXT": String,
    "HASHONLY": String
  },
  "ITEMS": [
    {
      "HASHVAL": Integer,
      "CNAME": String,
      "TYPE": String,
      "NAME": String,
      "VALUE": {
        "NAME": String,
        "METADATA": String
      }
    },
    ...
  ],
  ...
  "CNAME": String,
  "TYPE": String
}

cURL Example

curl -k -H "Content-Type: application/json" -X GET http://192.168.0.11:9001/menu_native/dynamic/audio_settings/input

Change input

PUT /menu_native/dynamic/audio_settings/input/current_input

Body

{
  "REQUEST": "MODIFY",
  "VALUE": String,
  "HASHVAL": Integer
}

Expected Values

PUT current_input From input
VALUE ITEMS[x].NAME
HASHVAL current_input.HASHVAL

Note: VALUE should be the NAME of the input to which you want to set the current_input. HASHVAL is the hash of the current_input, not the hash of the new input. This can be found on both the current_input and list of inputs requests. This means that a current_input request should always be performed as part of the change. The server will accept setting the current_input to the exact same input, as long as the HASHVAL is the correct hash from current_input.

cURL Example

curl -d {"REQUEST":"MODIFY", "VALUE":"Bluetooth", "HASHVAL": 2144756795}

Display Settings (Televisions)

Read Settings

Authenticated

GET /menu_native/dynamic/tv_settings/SETTINGS_CNAME (See Settings CNAMEs for SETTINGS_CNAME values)

Response

{
	"ITEMS": [{
		"NAME": String,
		"CNAME": String,
		"TYPE": String,
		"VALUE": String,
		"ENABLED": Boolean,
		"HASHVAL": Int,
		"ELEMENTS": Array
	},
	...
	],
	"NAME": String,
	"HASHLIST": Array,
	"GROUP": String,
	"PARAMETERS": {
		"HASHONLY": String,
		"FLAT": String,
		"HELPTEXT": String
	},
	...
}

Notes

ELEMENTS array is conditional.

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X GET https://myVizioTV:9000/menu_native/dynamic/tv_settings/picture

Write Settings

Authenticated

Warning Writing an invalid value may have the potential to brick sets. Use the TYPE key from SETTINGS_CNAME ITEMS array to determine the data type to write.

PUT /menu_native/dynamic/tv_settings/SETTINGS_CNAME/ITEMS_CNAME

Body

{
	"REQUEST": "MODIFY",
	"HASHVAL": Integer,
	"VALUE": String/Integer/Boolean
}

Notes

Obtain ITEMS_CNAME and HASHVAL values from the SETTINGS_CNAME ITEMS array.

cURL Example

curl -k -H "Content-Type: application/json" -H "AUTH: 123A456B" -X PUT -d '{"REQUEST": "MODIFY", "HASHVAL": 831638627, "VALUE": "On"}' https://myVizioTV:9000/menu_native/dynamic/tv_settings/picture/game_low_latency

Appendix

Settings CNAME's

SETTINGS_CNAME
picture
picture/picture_size
picture/picture_position
picture/picture_mode_edit
picture/color_calibration
picture/color_calibration/color_tuner
picture/color_calibration/calibration_tests
audio
timers
network
channels
closed_captions
devices
system
system/system_information
system/system_information/tv_information
system/system_information/tuner_information
system/system_information/network_information
system/system_information/uli_information
mobile_devices
cast

Misc

Status Responses

RESULT
success
failure
uri_not_found
aborted
busy
blocked
requires_pairing
requires_system_pin
requires_new_system_pin
net_wifi_needs_valid_ssid
net_wifi_already_connected
net_wifi_missing_password
net_wifi_not_existed
net_wifi_missing_password
net_wifi_needs_valid_ssid
net_wifi_auth_rejected
net_wifi_connect_timeout
net_wifi_connect_aborted
net_wifi_connection_error
net_ip_manual_config_error
net_ip_dhcp_failed
net_unknown_error

Types

ITEM
T_UNKNOWN_V1
T_NO_TYPE_V1
T_HIDDEN_NETWORK_V1
T_DST_LIST_V1
T_MENU_V1
T_MENU_X_V1
T_LIST_V1
T_LIST_X_V1
T_VALUE_ABS_V1
T_VALUE_V1
T_STRING_V1
T_PIN_V1
T_IP_ADDRESS_V1
T_MAC_ADDRESS_V1
T_MATRIX_V1
T_HEADER_V1
T_ROW_V1
T_DEVICE_V1
T_ACTION_V1
T_APS_V1
T_AP_V1
T_PASSWORD_V1
T_SOFTAP_CONFIG_V1
T_LIST_PAIRED_DEVICES_V1
T_TEST_CONNECTION_V1
T_IETF_2822_STRING_V1
T_DATE_V1
T_LIST_CEC_DEVICE_V1
T_MANUAL_IP_CONFIG_V1
T_VIZIO_DEVICE_INFO_V1
T_UPDATE_INFO_V1
T_ARRAY_V1
T_EMAIL_V1
T_LIST_VALUES_V1
T_CEC_DEVICE_V1

Additional Remote Codes

ed: I can't see where these are used, but included anyway for completion.

Note

Add a MODIFIER pair to /key_command request if used.

Event Name Codeset Code Modifier
0 0 48
1 0 49
& 0 38
* 0 42
Backspace 0 8
Bel 0 7
Cancel 0 14
, 0 44
$ 0 36
Esc 0 27
! 0 33
\ 0 47
- 0 45
( 0 40
Linefeed 0 10
% 0 37
. 0 46
+ 0 43
# 0 35
" 0 34
Return 0 13
) 0 41
' 0 39
Space 0 52
Tab 0 9
Audio MTS 5 5 TYPE
MTS Cycle 5 6 TYPE
Picture Mode 6 0
Wide Mode 6 1
Wide Cycle 6 2

Additional Remote Code Sets

Name Codeset
ASCII 0
Key Modifier 1
Transport 2
D-Pad 3
Nav 4
Audio 5
Video 6
Input 7
CH 8
Color 9
Launch 10
Power 11
3D 12
CC 13
Factor 14

About

API documentation for Vizio SmartCast TV's

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published