@kbrown01 Thank you so much for everything you have shared here. We frequently have our remotes stolen and hidden away by our Toddler so I was looking for something that we can use when we can’t find a remote. Our two Android TVs were super easy, I just copied the example text from Home Assistant, and it worked perfectly but getting my Mother-in-law’s Vizio to work was more difficult. Your contributions here got me started and lead me to the path on what I needed to do.
Since my setup is much simpler and I think most people are coming to this post for questions about their Vizio Setup, here is what I did.
what I added to the configurations.yaml file:
vizio:
- host: 'xxx.xxx.xxx.xxx:7345'
access_token: **********
rest_command:
vizio_key:
url: 'https://xxx.xxx.xxx.xxx:7345/key_command/'
method: PUT
content_type: "application/json"
headers:
AUTH: **********
payload: '{"KEYLIST": [{"CODESET": {{ codeset | int }},"CODE": {{ code | int }},"ACTION":"KEYPRESS"}]}'
verify_ssl: false
The code for the card. I started with copying the sample code for the Android TVs and edited it to use the API calls instead:
type: vertical-stack
cards:
- type: entities
entities:
- entity: media_player.VizioTV
title: Mamita's TV Control
- square: true
columns: 3
type: grid
cards:
- type: button
show_icon: false
tap_action:
action: none
hold_action:
action: none
- show_name: true
show_icon: true
type: button
icon: mdi:arrow-up-bold
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 3
code: 8
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
show_icon: false
tap_action:
action: none
hold_action:
action: none
- type: button
icon: mdi:arrow-left-bold
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 3
code: 1
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:circle
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 3
code: 2
target:
entity_id: media_player.guest_room_tv
hold_action:
action: call-service
service: remote.send_command
data:
command: DPAD_CENTER
hold_secs: 0.5
target:
entity_id: media_player.guest_room_tv
- type: button
icon: mdi:arrow-right-bold
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 3
code: 7
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:arrow-left
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 4
code: 0
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:arrow-down-bold
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 3
code: 0
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:home-outline
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 4
code: 3
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- square: false
columns: 3
type: grid
cards:
- show_name: true
show_icon: true
type: button
icon: mdi:skip-previous
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 2
code: 11
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- show_name: true
show_icon: true
type: button
icon: mdi:play
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 2
code: 3
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- show_name: true
show_icon: true
type: button
icon: mdi:skip-next
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 2
code: 10
target:
entity_id: media_player.guest_room_tv
hold_action:
action: call-service
service: remote.send_command
data:
command: MEDIA_FAST_FORWARD
target:
entity_id: media_player.guest_room_tv
- type: button
icon: mdi:volume-off
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 5
code: 4
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:volume-medium
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 5
code: 0
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:volume-high
tap_action:
action: call-service
service: rest_command.vizio_key
data:
codeset: 5
code: 1
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- square: false
columns: 4
type: grid
cards:
- type: button
icon: mdi:youtube
tap_action:
action: call-service
service: remote.turn_on
data:
activity: https://www.youtube.com
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: button
icon: mdi:netflix
tap_action:
action: call-service
service: remote.turn_on
data:
activity: https://www.netflix.com/title
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: picture
image: >-
https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Amazon_Prime_Video_logo.svg/450px-Amazon_Prime_Video_logo.svg.png
tap_action:
action: call-service
service: remote.turn_on
data:
activity: https://app.primevideo.com
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: picture
image: >-
https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Disney%2B_logo.svg/440px-Disney%2B_logo.svg.png
tap_action:
action: call-service
service: remote.turn_on
data:
activity: https://www.disneyplus.com
target:
entity_id: media_player.guest_room_tv
hold_action:
action: none
- type: entity
entity: media_player.VizioTV
- type: media-control
entity: media_player.VizioTV
There are some inconsisties with entity names I don’t fully understand, but it works.
I also noticed the API Documentation Listed codeset 2 as Transport, which I figured must be for navigation within a video (I worked for a TV service for a couple years and transport sounded like a term they would use). Here is what I observed experimenting with codeset 2:
Codeset: Code: Action:
2 0 Seek Forward
2 1 Seek Backward
2 2 Pause
2 3 Play
2 4 Unknown
2 5 Skip Forward
2 6 Skip Backward
2 7 Skip Backward
2 8 Skip Forward
2 9 Pause
2 10 Next
2 11 Previous
I’m not 100% on what each of these actions are. I just recorded what I observed in Youtube playing a mix of music videos. I was most interested in the skip to next/previous item actions so I stopped testing after that.
I haven’t gotten the links to directly open apps to work yet. I tried adding a second rest_command into the configruations.yaml, but can’t get it to work correctly. I keep getting errors I don’t understand even though I think it should be possible. Ultimately I want something that looks kind of like this:
rest_command:
vizio_key:
url: 'https://xxx.xxx.xxx.xxx:7345/key_command/'
method: PUT
content_type: "application/json"
headers:
AUTH: **********
payload: '{"KEYLIST": [{"CODESET": {{ codeset | int }},"CODE": {{ code | int }},"ACTION":"KEYPRESS"}]}'
verify_ssl: false
vizio_launchApp:
url: 'https://192.168.0.216:735/app/launch/'
method: PUT
content_type: "application/json"
headers:
AUTH: 'Zwytkualvu'
payload: '{"VALUE": [{"MESSAGE": {{ message | string }},"NAME_SPACE":{{ name_space | int }},"APP_ID":{{ app_id | string }}}]}'
verify_ssl: false
I just can’t figure what’s wrong with my formatting.
Again, thank you so much! I wouldn’t be anywhere near where I am now without your guidance here.