VIZIO SmartCast


The vizio integration allows you to control SmartCast-compatible TVs and sound bars (2016+ models).

Find your device

If zeroconf discovery is enabled, your device will get discovered automatically. To discover your device manually, read the subsections below.

Install pyvizio locally

If the pip3 command is not found, try pip instead

  • To install, run pip3 install pyvizio in your terminal.
  • If pyvizio is already installed locally, make sure you are using the latest version by running pip3 install --upgrade pyvizio in your terminal.

Discover devices

Find your device using the following command:

pyvizio --ip=0 discover

Write down its IP address and port number. If you have trouble finding a device you were expecting to, you can try increasing the discovery timeout period by adding the --timeout option (e.g., pyvizio --ip=0 discover --timeout=10).

Pairing

This integration requires an access token in order to communicate with TVs (speakers do not need an access token). An access token can be obtained by going through a pairing process, either manually, or through the Home Assistant frontend.

Pair using the Home Assistant frontend

  • Using configuration.yaml: If you have a vizio entry in configuration.yaml but don’t provide an access token value in your configuration, after you initialize Home Assistant, you will see a Vizio SmartCast device ready to be configured. When you open the configuration window, you will be guided through the pairing process. While Home Assistant will store the access token for the life of your vizio entity, it is a good idea to note the access token value displayed in the window and add it to your configuration.yaml. This will ensure that you will not have to go through the pairing process again in the future if you decide to rebuild your Home Assistant instance.
  • Using discovery or manual setup through the Integrations menu: To initiate the pairing process, submit your initial configuration with an empty Access Token value.

Pair manually using the CLI

The following script, written by JeffLIrion can be run to obtain an auth token. You will need to replace <IP> with your IP and <PORT> (which is typically 7345 or 9000).

#!/bin/bash

VIZIO_IP="<IP>"
VIZIO_PORT="<PORT>"

curl -k -H "Content-Type: application/json" -X PUT -d '{"DEVICE_ID":"pyvizio","DEVICE_NAME":"Python Vizio"}' https://${VIZIO_IP}:${VIZIO_PORT}/pairing/start

read -p "PIN:  " VIZIO_PIN
read -p "PAIRING_REQ_TOKEN:  " VIZIO_PAIRING_REQ_TOKEN

curl -k -H "Content-Type: application/json" -X PUT -d '{"DEVICE_ID": "pyvizio","CHALLENGE_TYPE": 1,"RESPONSE_VALUE": "'"${VIZIO_PIN}"'","PAIRING_REQ_TOKEN": '"${VIZIO_PAIRING_REQ_TOKEN}"'}' https://${VIZIO_IP}:${VIZIO_PORT}/pairing/pair

Pair manually using pyvizio

To obtain an auth token manually, follow these steps:

Make sure that your device is on before continuing.

Parameter Description
ip IP Address:Port (obtained from the previous section)
device_type The type of device you are connecting to. Options are tv or speaker

Enter the following command to initiate pairing:

pyvizio --ip={ip:port} --device_type={device_type} pair

Initiation will show you two different values:

Value Description
Challenge type Usually, it should be "1".
Challenge token Token required to finalize pairing in the next step

At this point, a PIN code should be displayed at the top of your TV. With all these values, you can now finish pairing:

pyvizio --ip={ip:port} --device_type={device_type} pair-finish --token={challenge_token} --pin={pin} --ch_type={challenge_type}

You will need the authentication token returned by this command to configure Home Assistant.

Configuration

To add your Vizio TV to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
vizio:
  - host: "DEVICE_IP:DEVICE_PORT"
    access_token: AUTH_TOKEN

Configuration Variables

host

(string)(Required)

IP Address:Port for your device (port is optional but recommended).

name

(string)(Optional)

Nickname for your device that will be used to generate the device’s entity ID. If multiple Vizio devices are configured, the value must be unique for each entry.

Default value:

Vizio SmartCast

access_token

(string)(Optional)

Authentication token you received in the last step of the pairing process. This token is only needed if your device is a TV, and you can opt not to provide it in your configuration and instead go through the pairing process via the Home Assistant frontend.

device_class

(string)(Optional)

The class of your device. Valid options are tv or speaker.

Default value:

tv

volume_step

(integer)(Optional)

The number of steps that the volume will be increased or decreased by at a time.

Default value:

1

apps

(map)(Optional)

Use this section to define app specific settings (only applicable for Vizio Smart TVs).

include

(list)(Exclusive)

List of apps to include in the source list. Cannot be used in combination with exclude.

exclude

(list)(Exclusive)

List of apps to exclude from the source list. Cannot be used in combination with include.

additional_configs

(map)(Optional)

List of manually configured apps that aren’t available in the default app list provided by the integration.

name

(string)(Required)

The name of the app that will be used in the source list and used to launch the app.

config

(map)(Required)

The app configuration that will be used to detect and launch the app.

APP_ID

(string)(Required)

See Obtaining an app configuration section below.

NAME_SPACE

(integer)(Required)

See Obtaining an app configuration section below.

MESSAGE

(string)(Optional)

See Obtaining an app configuration section below.

# Complete configuration.yaml entry
vizio:
  - host: "DEVICE_IP:DEVICE_PORT"
    access_token: AUTH_TOKEN
    name: MY_VIZIO_DEVICE
    device_class: tv
    volume_step: 1
    apps:
      include:
        - APP_1
        - APP_2
      exclude:
        - APP_1
        - APP_2
      additional_configs:
        - name: MY_CUSTOM_APP
          config:
            APP_ID: 9
            NAME_SPACE: 9
            MESSAGE: MY_MESSAGE

Obtaining an app configuration

If there is an app you want to be able to launch from Home Assistant that isn’t detected by default, you will need to specify the app configuration in configuration.yaml. This configuration can be obtained from the app_id state attribute when an unknown app is running on your device.

Obtaining a list of valid apps to include or exclude

The list of apps that are provided by default is statically defined here. If you’d prefer a more concise list, you can either view the source list of a Vizio Smart TV in the Home Assistant frontend, or run the following command (requires pyvizio to be installed locally):

pyvizio --ip=0 get-apps-list

Notes and limitations

Turning device on

If the Power Mode of your device is set to Eco Mode, turning the device on won’t work.

Changing tracks

Changing tracks works like switching channels. If the current input is anything other than regular TV, this command might not do anything.