Vizio SmartCast

I’ve been wanting to be able to turn my TV on and off through HASS for a while now, but up until just recently, I haven’t been able to find any documented API for SmartCast. Now there is one here:

With that information, I was able to put together a command line switch

   - platform: command_line
          friendly_name: TV
          command_on: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: xxxx\" -X PUT -d '{\"KEYLIST\": [{\"CODESET\": 11,\"CODE\": 1,\"ACTION\":\"KEYPRESS\"}]}' https://TV_IP_ADDRESS:9000/key_command/"
          command_off: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: xxxx\" -X PUT -d '{\"KEYLIST\": [{\"CODESET\": 11,\"CODE\": 0,\"ACTION\":\"KEYPRESS\"}]}' https://TV_IP_ADDRESS:9000/key_command/"
          command_state: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: xxxx\" -X GET https://TV_IP_ADDRESS:9000/state/device/power_mode"
          value_template: >
            {% if value_json.ITEMS.0.VALUE == 1 %}
            {% else %}
            {% endif %}

To get that working, there is an auth token that is required. That is available by following the “Pairing” section of the API docs.


This is an awesome find!!

Can you use this to switch the input to a specific input - as opposed to cycling through them?

This switch can just turn the TV on and off. The API does allow setting a specific input to change to

A full-blown component is something that would be really useful at some point.


could someone explain a little not how to get this done? i would love to try it!!.. ive read the github page but it makes know scene to me

Hey kilosgreen, the github page has examples of how you would run these commands directly on a linux or osx terminal session using the curl command. So if you’re running HASS on a linux or osx box you should have no problems running these commands in a terminal window. Windows machine will most likely need to install curl, or use a vm like gitbash or cygwin. If you’re on windows try this stackoverflow to install curl.

Donno your technical level but did a quick google of curl tutorials and found this one that might help you.

To start using the vizio API u start with finding the IP of your TV. I found that using my router was an easy way of looking that up. Once you have ur TV’s IP you can start sending messages to it.

The flow to this API is:

  • Send ‘Start paring’ request - set the DEVICE_ID to something you will remember and will be unique
    – Note the “DEVICE_ID” you sent and the response field “PAIRING_REQ_TOKEN”, we will need these later
  • A 4 digit code will be displayed on the top of ur screen for the next step
  • Send the ‘Submit Challenge’ request - use the same DEVICE_ID and PAIRING_REQ_TOKEN from the previous message. Set the field “RESPONSE_VALUE” with the 4 digit value shown on the screen
  • If the pairing worked ur TV should make a sound and the response of the ‘Submit Challege’ request should include an “AUTH_TOKEN” field. Use value on any request that is denoted needing an auth token.
  • Start sending messages to ur tv!

@cbulock Awesome find, I was thinking about trying to reverse engineer this myself, saves me a lot of work. Thanks!

1 Like

I’m having issues with the commands when my TV is off, did you run into that at all? The commands work great while its on, but I can’t seem to turn it on, or get power state when its off.

I haven’t run into that problem, but I would suspect maybe it’s related to the power save mode. I have mine set to “quick start” instead of the Eco mode.

Yep that was it. I was on Eco and changing to quick start fixed my issue. Thanks!

Thank you for the replay ill give it a shot tomorrow after work and let you know how it goes

it worked!! thank you for your help

This is great, working on figuring out a way to integrate volume control as well. I have the command working, but I need to find a way to implement the curl command into HASS for volume up / volume down.

I posted a request under Feature Requests for a Vizio SmartCast component. Hopefully someone will pick it up and create a native component :slight_smile:

1 Like

Nice find, hope someone figures it out

Greetings, nise finding, was struggling with CEC, was able to port to direct component now. I didn’t submit pull request yet, maybe will have some time later this week. Meanwhile you can use this custom component

configuration is simple

  - platform: vizio
    host: IP
    access_token: token
    name: Vizio TV Main

Instructions how to get IP and token are here

Was finally able to finish my RPi/Librespot + Spotify setup. Without unpredicted CEC it’s so much better.


I think I may wait on the PR but this is tempting. Nice work - thanks!

Just tested it out with my TV and it’s working great! Thanks for your work. Looking forward to it being an official component

Hi Everyone,
Great finding. Can some one please mention what are the exact Vizio TV models it worked on ?
Did it work on the Vizio D-Series/ E-Series / M-Series / P-Series ?

Thanks a lot,
Vadim L.

I was using a 2016 M-Series for my setup, which is also working great with the official component that is out now

1 Like

How much farther will this have to go so new people like myself who are using can add Vizio as a component? We aren’t able to do any command line stuff except reboot just about.

There is an official component now, no longer need to do this command line stuff