Vizio SmartCast Soundbar: How to figure out the list of valid values for settings?

I have My Vizio Smartcast soudnbar integrated and visible as a device. However, I’m having issue figuring out valid values to be able to call into the vizio.update_setting service.

The docs say:

You will need to know the type of setting and the name of the setting to call this service. You can determine this by using the SmartCast app and going to device settings for your target device. The setting type is the lowercase version of the first menu item you’d select (e.g., display, audio, system), and the setting name is what you see in the app, but spaces are replaced with underscores and it is also all lowercase (e.g., AV delay would be called av_delay).

This is fine, as I can call to change the EQ mode with this yaml:

entity_id: media_player.living_room_vizio_soundbar
setting_type: audio
setting_name: eq
new_value: Music

(Note: It’s weird that the new value has to be title case – Music works, but music will not. Oh well)

I’m trying to figure out how to adjust night mode and volume. Both these mode names seem to be correct as night_mode and volume as the logs aren’t throwing errors as invalid setting names. The logs however are throwing errors for invalid new values:

[pyvizio] Failed to execute command: invalid value specified

for this:

entity_id: media_player.living_room_vizio_soundbar
setting_type: audio
setting_name: night_mode
new_value: true

I’ve tried values of true, 1, yes and on and all don’t work.

Is there a simpler way to know what the valid values are for each setting?

Unfortunately I can’t help you with an answer here, but I feel your pain. I’m currently struggling with the same issue on with a Vizio TV. There seems to be a dearth of information on actually using the vizio.update_setting. Particularly in regard to finding a canonical list of valid setting_type or setting_name values. Somewhere I found a reference that says to use the Smartcast app device via the Settings->device listing which might help, but not with something as simple as power on/off/toggle. I know I’ve seen “power_mode”, but I’m not even sure if that’s a setting_type or setting_name unfortunately.

2 Likes

Hi @PolarLava and @tmchow, if you want to do things like turn the device on or off, change the volume, mute or unmute, I would use the media_player services for those actions as they should work without issue: https://www.home-assistant.io/integrations/media_player/#media-control-services

The update_setting service is intended to change device settings like night mode, EQ, etc. as @tmchow mentioned.

Regarding finding the valid values, you can use pyvizio to do this:

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-all-settings-options {setting_type}

in this case the setting_type would be audio. I have an idea on how to improve this using the options flow but haven’t had a chance to work on it, hopefully I will get to it soon. In the meantime, hope this helps!

1 Like

Thanks for the response @raman325! If I want to do automation to have the Vizio soundbar change inputs, are you saying to use the media control service for source?

I’ve never used those services before so thanks for pointing it out. Given the vizio soundbar has specific names for input sources, how does this work with the HA abstractino through media control services?

Yes, you should use the media control services. The select_source service has a source property which is specific to the device: https://www.home-assistant.io/integrations/media_player/#service-media_playerselect_source

1 Like

@raman325,

Thanks for pointing me in the right direction. I hadn’t seen the media player entity associated with the TV, nor had I seen that documented anywhere. Guess that make sense though.

Generally speaking, if an integration falls under a certain category, it will likely respond to services that come out of the box for that category. I’m not sure that it’s readily apparent when you first start looking at the docs but it is a common pattern across all integrations.

Oh, I get it I just overlooked it I guess. I’ve worked with other media devices, but didn’t think about that with the TV because my other TV I previously automated is an older Sony that I was controlling via a Broadlink RM3 because it didn’t have an integration.

@raman325 so are you saying that if the Vizio Soundbar has an input name of HDMI-1 or HDMI 1 (hyphen vs no hyphen) they are likely exposed as those names through the media player select_source?

Yes. You can see the available sources by either:

  1. Going to the “Developer Tools > States” page in the UI and look up the vizio media player entity. In it’s attributes all of the sources will be listed and you should use the same formatting when calling the service.
  2. Add a media player entity card for your vizio media player entity to any Lovelace dashboard. You will see the source list on the card, same rules apply
1 Like

@raman325 THANK YOU!

@raman325 So I’ve made some progress utilizing media player services to do thing such as powering the TV on and off as well as adjusting the volume. But now I’m stuck at trying to understand how change changes and such via the vizio.update_setting service. I’m not certain what I’m supposed to be using for the data and have been unable to figure it out trying various inputs such as…

entity_id: media_player.casttv
setting_type: channel
setting_name: channel
new_value: up

I know using channel for both type and name is not correct, nor is using key-press for the type. Again, I’m unable to find a source of what to use for these values. I’be been digging around through the API docs and looking at your pyvizio branch and I’m still stumped. Also confused because I enabled HA debugging for pyvizio and when I call vizio.update_setting it’s doing so as a GET and not a PUT as I would expect it would.

2020-12-15 13:32:51 DEBUG (MainThread) [pyvizio.api._protocol] Using Command: GetSettingCommand({'_url': '/menu_native/dynamic/tv_settings/channel/channel', 'item_name': 'channel', 'default_return': 0, 'setting_type': 'channel'})
2020-12-15 13:32:51 DEBUG (MainThread) [pyvizio.api._protocol] Using Request: {'method': 'get', 'url': 'https://<IP>:7345/menu_native/dynamic/tv_settings/channel/channel', 'headers': {'AUTH': '<AUTH>'}}
2020-12-15 13:32:51 DEBUG (MainThread) [pyvizio.api._protocol] Response: {'STATUS': {'RESULT': 'URI_NOT_FOUND', 'DETAIL': 'URI not found'}, 'URI': '/menu_native/dynamic/tv_settings/channel/channel'}
2020-12-15 13:32:51 ERROR (MainThread) [pyvizio] Failed to execute command: unexpected status URI_NOT_FOUND: URI not found
2020-12-15 13:32:51 ERROR (MainThread) [pyvizio] Couldn't detect setting for channel of setting type channel

Thoughts?

@raman325 not sure about your level of involvement with pyvizio itself, but one think I did note is that it says to us the “help” function, but it doesn’t! :wink:

odroid@levin:/home/homeassistant/.homeassistant$ pyvizio --ip=<IP>:7345 --device_type=tv --auth=<AUTH> key-press
Usage: pyvizio key-press [OPTIONS] KEY
Try 'pyvizio key-press --help' for help.

Error: Missing argument 'KEY'.
odroid@levin:/home/homeassistant/.homeassistant$ pyvizio --ip=<IP>:7345 --device_type=tv --auth=<AUTH> key-press --help
Usage: pyvizio key-press [OPTIONS] KEY

Options:
  --help  Show this message and exit.

I think you are getting a bit confused about how the services work. For standard media player functionality, like changing channels, adjusting volume, etc. use media_player.* services. The vizio services are provided to do vizio device specific things. In the case of update settings, it’s used to update the settings of the device like Audio settings (EQ, night mode, etc), Picture settings, Network settings, etc.

There’s no other hidden information unfortunately. The CLI is pretty bare bones, if you want to see what keys are supported, look here: https://github.com/vkorn/pyvizio/blob/0fe4558557917509d3da3bb24f9221f15ba901ce/pyvizio/api/_protocol.py#L107-L165

Then use the appropriate string, e.g. pyvizio --ip=blah --auth=blah key-press PAUSE

Sorry to necro this thread, but “Channel” is not available in the HA media_player entities, source is.

When using an OTA antenna, the “source” is “TV” (as opposed to an HDMI input). I presume actually changing the OTA channels would involve invoking vizio.update_settings method, maybe with “setting_type”: “key-press”? I’ve failed to get any key-press actions to work, I always get “Couldn’t detect setting for <every setting name i’ve tried> of setting type key_press” on a 2019 M series.

Anyone have any luck invoking key-press commands?