Coder Social home page Coder Social logo

pyvizio's Introduction

Description

Simple cli and API implementation for Vizio SmartCast TVs and Speakers (Sound Bars). Mainly created for integration with HASS. Note that some of the interaction commands are not supported by speakers.

Installation

Use pip:

pip3 install pyvizio

or

pip install pyvizio

if pip3 is not found.

Upgrade

Use pip:

pip3 install --upgrade pyvizio

or

pip install --upgrade pyvizio

if pip3 is not found.

CLI Usage

To avoid repeating IP (--ip), Auth (--auth), and Device Type (--device_type) params in each CLI call, you can add them to environment variables as VIZIO_IP, VIZIO_AUTH, and VIZIO_DEVICE_TYPE respectively

--device-type options are tv and speaker. If the parameter is not included, the device type is assumed to be tv. Note that TVs always require a pairing process to get an auth token. Speakers may not always need an auth token but YMMV based on your particular model.

Find your device

First, find your device (yeah, I'm too lazy to add another cli group)

pyvizio --ip=0 discover

and note 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.

Pairing

Using your device's IP address and port number, request pairing procedure:

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

After running the above command:

  • For TVs, lookup the PIN code on your TV and note challenge token and type in console
  • For speakers, press the physical "Volume Up" and note challenge token and type in console

It's better to have your device turned on as it's "forgetting" the PIN sometimes if it was turned off prior to pairing command.

Using these data points, finalize pairing procedure: (a pin is not necessary for speakers as they appear to always use 0000)

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

If everything done correctly, you should see new connected device named Python Vizio in Vizio SmartCast mobile APP

For a TV, you'll need auth code for any further commands. If you are interacting with a Speaker, and skipped the pairing process, you don't need to include the --auth parameter in any of the following calls since you don't have an auth code.

Turning on/off

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} power {on|off|toggle}

To get current power state simply call

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-power-state

Volume operations

You could change volume

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} volume {up|down} amount

and get current level (0-100)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-volume-level

In addition mute command is available

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} mute {on|off|toggle}

Switching channels (TVs only)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} channel {up|down|prev} amount

Input sources

You can get current source (if the value is SMARTCAST, then an app is currently runniing)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-current-input

List all connected devices

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-inputs-list

And using Name column from this list, you can switch input:

pyvizio --ip={ip:port}  --device_type={device_type} --auth={auth_code} input {input_name}

Other options is to circle through all inputs

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} next-input

Managing audio settings

You may have to experiment to find the available options for a given setting. For example, numeric settings have a finite range. I've also found that certain ranges returned by the API aren't correct

List available audio setting names and their current values

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

Get the current value of a given audio setting

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-audio-setting {setting_name}

List available audio setting names and their available choices/ranges

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

Get the choices/range of a given audio setting

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-audio-setting-options {setting_name}

Set a new value for a given audio setting

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} audio-setting {setting_name} {new_value}

Managing any setting type

List all available setting types

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-setting-types-list

List available setting names and their current values for a given setting type

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

Get the current value of a given setting (must specify setting type)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-setting {setting_type} {setting_name}

List available setting names and their available choices/ranges for a given setting type

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

Get the choices/range of a given setting (must specify setting type)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-setting-options {setting_type} {setting_name}

Set a new value for a given setting (must specify setting type)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} setting {setting_type} {setting_name} {new_value}

Apps (TVs with app support only)

Get a list of available apps by name (this will attempt to get the latest list of apps which is stored exterenally, but will fall back to a static list found in the Vizio SmartCast Android source code. If you would like to add apps to the static list and can retrieve the latest source code, you can use pyvizio.util.gen_apps_list_from_src("path/to/root/of/source") to retrieve the latest list. The list is stored in APPS in pyvizio/_api/apps.py and you are welcome to submit a PR with updates)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-apps-list

Get currently running app (if value is _NO_APP_RUNNING then no app is currently running, and if the value is _UNKNOWN_APP then the app name couldn't be determined from the current APPS list)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-current-app

Launch an app (app names must match the names listed in the get-apps-list command but are not case sensitive. Be sure to use quotes if the app name has a space)

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} launch-app "{app_name}"

If an app isn't found by name, but you know the config required to launch it, you can specify the config

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} launch-app-config {APP_ID} {NAME_SPACE} {MESSAGE}

One way to get the config of an app that is not already stored in the APPS list is to launch the app on your device and then run

pyvizio --ip={ip:port} --device_type={device_type} --auth={auth_code} get-current-app-config

Contribution

Thanks for great research uploaded here and absolutely awesome SSDP discovery snippet

pyvizio's People

Contributors

anaisbetts avatar bjohnson8949 avatar davbebawy avatar dependabot[bot] avatar heathbar avatar jefflirion avatar jezzab avatar nostachio avatar photinus avatar raman325 avatar vkorn avatar zackoch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvizio's Issues

"Cannot serialize non-str key None" when retrieving list of audio settings

With latest Git master, installed right now, and using a Vizio SB4551D sound bar:

$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 get-audio-settings-list
ERROR:pyvizio:Failed to execute command: Cannot serialize non-str key None
ERROR:pyvizio.cli:Couldn't get list of audio settings

Thanks.

Can't switch inputs; other commands work.

Hello friends...
when I execute:
pyvizio --ip=####### --device_type=tv --auth=######### get-inputs-list
I get:

INFO:pyvizio.cli:
Name Nickname


CAST SMARTCAST
HDMI-1 AVR-S700W
HDMI-2 Matrix
HDMI-3 PC 4K
COMP COMP
TV TV

BUT, when I execute pyvizio --ip=####### --device_type=tv --auth=######### input HDMI-2
I get:
INFO:pyvizio.cli:Switching input
ERROR:pyvizio:Failed to execute command: unexpected status FAILURE: Failure
INFO:pyvizio.cli:ERROR

Any suggestions? This used to work. To troubleshoot, I recently ran pip3 install --upgrade pyvizio. Any help would be much appreciated :)

External Source for APPS is gone

The external source for APPS no longer exists.

This link provides nothing: http://hometest.buddytv.netdna-cdn.com/appservice/vizio_apps_prod.json

The internal list of APPS lacks tons of APPS that no longer can be selected from code bases that depend on this, like Home Assistant.

The only selectable APPS in Home Assistant are now the APPS built into the code. I know this because I hacked in a guess for "HBO Max" in const.py and got it working (although I have no idea what the key "id" is, but for unknown APPS I can get the NAME_SPACE and APP_ID by going to that APP.

    {
        "name": "HBO Max",
        "country": ["usa"],
        "id": ["29"],
        "config": [
            {
                "NAME_SPACE": 4,
                "APP_ID": "128",
                "MESSAGE": "https://vizio.play.hbomax.com/"
            }
        ]
    },

Before I embark on going to every APP in the TV and recording the Namespace and APP_ID, PLEASE tell me someone has a copy of the JSON file before that website died. If so, please post here.

Mismatched upper/lower case named arguments in launch-app-config

Mismatched upper/lower case named arguments in launch-app-config (e.g. APP_ID vs app_id)

when issuing:

root@localhost:~# /usr/local/bin/pyvizio --ip=xxx.xxx.xxx.xxx --device_type=tv --auth=xxxxxxxxxxx launch-app-config 4 3

error received:

TypeError: launch_app_config() got an unexpected keyword argument 'app_id'

complete error:

Traceback (most recent call last):
File "/usr/local/bin/pyvizio", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/pyvizio/helpers.py", line 13, in wrapper
return asyncio.run(f(*args, **kwargs))
File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
TypeError: launch_app_config() got an unexpected keyword argument 'app_id'

My knowledge of Python is very basic so I patched the error by changing all the named arguments in cli.py to lower case

FILE: /usr/local/lib/python3.9/dist-packages/pyvizio/cli.py
LINE: async def launch_app_config(...

OLD: vizio: VizioAsync, APP_ID: str, NAME_SPACE: int, MESSAGE: str
NEW: vizio: VizioAsync, app_id: str, name_space: int, message: str

I also replaced all subsequent referenecs to this arguments within that same function

No longer works at all

Sorry for this terrible issue title but I can't think of another that describes what's going on.

Pyvizio used to work nicely, but now nothing does. Here is what I've tried:

  • pyvizio --ip=0 discover --timeout 60 shows nothing, either on Windows 10 running in cmd, running under WSL2, or running in a Ubuntu Docker container running on Windows. Tried with the latest from Pip and also with the latest master. I see no errors asking me to permit traffic through Windows firewall.
  • Under Linux, discovery seems to work at least. It confirms the IP found via my router.
  • I've confirmed via DHCP in my router, that my soundbar has the IP 192.168.0.100.
  • curl -kv https://192.168.0.100:9000 reveals:
< HTTP/1.1 503 Service Not Available
< Content-Type: text/html
< Content-Length: 369
< Date: Tue, 15 Sep 2020 20:06:46 GMT
< Server: lighttpd/1.4.35
<
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>503 - Service Not Available</title>
 </head>
 <body>
  <h1>503 - Service Not Available</h1>
 </body>
</html>
  • All other commands on either Windows or Linux output:
root@4d062df465bd:/# pyvizio --device_type speaker --ip 192.168.0.100:9000 get-all-audio-settings
ERROR:pyvizio:Failed to execute command: Device is unreachable? Status code: 503
ERROR:pyvizio.cli:Couldn't get list of audio settings
  • The speaker otherwise works, and outputs audio fine now. It's almost as if it upgraded to an incompatible firmware or something. I haven't needed to tweak speaker settings for a while now, but now that I do, pyvizio isn't working for me.

Thoughts on what else I can try? Saw in a recent issue you had app recommendations for debugging MDNS traffic. Happy for such recommendations under Windows, but the issues seem to run deeper than discovery.

Thanks.

Soundbar constantly becomes unresponsive to api calls

My SB36512-F6 soundbar loses wifi constantly. At best it will stay connected for a few days, but usually it drops the connection in less than a day. It still gets audio from HDMI-ARC and/or Bluetooth, but it becomes unavailable in Home Assistant and the SmartCast android app until I unplug the power and plug it back in. I tried using ethernet instead (with a wifi bridge) but I had the same issue. ECO mode is off on the soundbar. It is connected to a TCL Roku TV. On the Roku TV I have enabled 'Fast TV Start' and disabled the power-saving shut off (after 4 hours idle). The soundbar has a reserved IP address on my router. I've had this issue for a while and I tried a factory reset a while back. I searched online but haven't found anyone with the same issue. The only thing I can think of now is to put it on a smart plug and make an automation to reboot it whenever it becomes unavailable in HA. I'd rather fix the issue though. I was wondering if pyvizio or the HA vizio integration was somehow contributing to this problem.
Any suggestions would be appreciated.

_Unknown_APP when in chromecast mode

When casting an app to my Vizio PQ65-F1 Latest vizio firmware the output of "get-current-app" fails because it appears Vizio will provide the "Chromecast" APPID when streaming.

Previously this was fine because this would mean the Chromecast device presented in Home-Assistant would be the focus when source=CAST ..

Now I get
AppConfig({'APP_ID': 'C3DE6BC2', 'NAME_SPACE': 0, 'MESSAGE': None})

Not sure if there is a method to do lookups on chromecast App_ID's or a better way to display then _UNKNOWN_APP

Exception Error

It works but I figured there's something that could be cleaned up somewhere. I get this error every command I run. The command works though.

INFO:pyvizio.cli:
Name    Nickname
------  ----------
CAST    SMARTCAST
HDMI-1  Cable Box
HDMI-2  HDMI-2
HDMI-3  HDMI-3
COMP    COMP
TV      TV
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000244C1364790>
Traceback (most recent call last):
  File "c:\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

No Soundbar Pairing

I successfully paired my Vizio TV, but can't seem to get my SmartCast Sound Bar 3821-D6. It has no display and no way to get a PIN.

pi@HomeControl:~ $ pyvizio --ip 192.168.86.205 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
INFO:pyvizio.cli:Challenge type: 6
INFO:pyvizio.cli:Challenge token: 908397
pi@HomeControl:~ $ pyvizio --ip 192.168.86.205 pair_finish --ch_type=6 --token=908397
Usage: pyvizio pair_finish [OPTIONS]

Error: Missing option "--pin".
pi@HomeControl:~ $ 

Soundbar pairing but not able to get current volume

Version: 0.0.4

While pairing is possible appending :9000 to the ip and setting the ch_type=6 from #4 I cannot get hass to connect. Since hass wants to get the current volume to check if the connection is valid.

Manually trying to get the current volume results in:

ERROR:pyvizio.vizio:Failed to execute command: Unexpected response URI_NOT_FOUND: URI not found
INFO:pyvizio.cli:Current volume: None

I attempted reverting the path from #13 but that resulted in the same error. Not knowing how to figure out the API path, if it exists, I'm stuck now.

Movies Anywhere

Vizio recently added the Movies Anywhere app to SmartCast, is this something that can be added? I am trying to select it as a source using HASS.
Thanks.

CLI Fails on key-press up/get-remote-key-list

Installed via pip3 today June 21 2022
Running Program on MacOS with Python 3.8.9
Setup PATH vars for tv/ip/port and did auth flow. Can power on/toggle and list apps

pyvizio get-remote-keys-list

returns

sys:1: RuntimeWarning: coroutine 'get_remote_keys_list' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

pyvizio key-press right

returns

INFO:pyvizio.cli:Emulating pressing of 'right' key
ERROR:pyvizio:Failed to execute command: unexpected status BLOCKED: Operation blocked
INFO:pyvizio.cli:ERROR

Oddly, key-press down and key-press left/back/ok all seem to work fine.

Let me know if you need any additional logging information or tv information.

Failing to Pair

pair_finish fails on E55U-D2 with up to date firmware

jaytomten@remlinvm1:$ pyvizio --ip=192.168.1.15 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
INFO:pyvizio.cli:Challenge type: 1
INFO:pyvizio.cli:Challenge token: 213081
jaytomten@remlinvm1:
$ pyvizio --ip={ip} pair_finish --token=213081 --pin=1835
INFO:pyvizio.cli:Finishing pairing
ERROR:pyvizio.vizio:Failed to execute command: HTTPSConnectionPool(host='%7bip%7d', port=9000): Max retries exceeded with url: /pairing/pair (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb670082c>: Failed to establish a new connection: [Errno -2] Name or service not known',))
jaytomten@remlinvm1:$ pyvizio --ip=192.168.1.15 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
ERROR:pyvizio.vizio:Failed to execute command: Unexpected response BLOCKED: Operation blocked
jaytomten@remlinvm1:
$ pyvizio --ip=192.168.1.15 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
ERROR:pyvizio.vizio:Failed to execute command: Unexpected response BLOCKED: Operation blocked
jaytomten@remlinvm1:$ pyvizio --ip=192.168.1.15 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
ERROR:pyvizio.vizio:Failed to execute command: Unexpected response BLOCKED: Operation blocked
jaytomten@remlinvm1:
$ pyvizio --ip={ip} pair_finish --token=476666 --pin=1835
INFO:pyvizio.cli:Finishing pairing
ERROR:pyvizio.vizio:Failed to execute command: HTTPSConnectionPool(host='%7bip%7d', port=9000): Max retries exceeded with url: /pairing/pair (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb670982c>: Failed to establish a new connection: [Errno -2] Name or service not known',))
jaytomten@remlinvm1:$ ^C
jaytomten@remlinvm1:
$ pyvizio --ip=192.168.1.15 pair
INFO:pyvizio.cli:Initiating pairing process, please check your TV for pin upon success
/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
INFO:pyvizio.cli:Challenge type: 1
INFO:pyvizio.cli:Challenge token: 809424
jaytomten@remlinvm1:$ pyvizio --ip={ip} pair_finish --token=809424 --pin=1546
INFO:pyvizio.cli:Finishing pairing
ERROR:pyvizio.vizio:Failed to execute command: HTTPSConnectionPool(host='%7bip%7d', port=9000): Max retries exceeded with url: /pairing/pair (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb677e82c>: Failed to establish a new connection: [Errno -2] Name or service not known',))
jaytomten@remlinvm1:
$

2020 Vizio TVs Return URI Not Found on version check

The version endpoint on 2020 Vizio TVs appears to have moved to /menu_native/dynamic/tv_settings/admin_and_privacy/system_information/tv_information/version, while older devices remain at /menu_native/dynamic/tv_settings/system/system_information/tv_information/version as pyvizio is currently written to use.

I had enough know-how to find the issue, but not enough to know how to fix it.
Likely needing a condition, or something like try one, if fail, try the other?

I've only had the ability to test this against a V405-H9M myself and found it while trying to pair it with Home Assistant, but also saw this reported by other Home Assistant users: https://community.home-assistant.io/t/vizio-smartcast-tv-cannot-connect/240378/2

Log snippet from Home Assistant below:

2020-11-11 22:28:58 DEBUG (MainThread) [pyvizio.api._protocol] Using Command: GetVersionCommand({'_url': '/menu_native/dynamic/tv_settings/system/system_information/tv_information/version', 'item_name': 'VERSION', 'default_return': None})
2020-11-11 22:28:58 DEBUG (MainThread) [pyvizio.api._protocol] Using Request: {'method': 'get', 'url': 'https://192.168.1.102:7345/menu_native/dynamic/tv_settings/system/system_information/tv_information/version', 'headers': {}}
2020-11-11 22:28:58 DEBUG (MainThread) [pyvizio.api._protocol] Response: {'STATUS': {'RESULT': 'URI_NOT_FOUND', 'DETAIL': 'URI not found'}, 'URI': '/menu_native/dynamic/tv_settings/system/system_information/tv_information/version'}
2020-11-11 22:28:58 ERROR (MainThread) [pyvizio] Failed to execute command: unexpected status URI_NOT_FOUND: URI not found

And curl results against each endpoint:

$ curl -k https://192.168.1.102:7345/menu_native/dynamic/tv_settings/system/system_information/tv_information/version
{"STATUS": {"RESULT": "URI_NOT_FOUND", "DETAIL": "URI not found"}, "URI": "/menu_native/dynamic/tv_settings/system/system_information/tv_information/version"}
$ curl -k https://192.168.1.102:7345/menu_native/dynamic/tv_settings/admin_and_privacy/system_information/tv_information/version
{"STATUS": {"RESULT": "SUCCESS", "DETAIL": "Success"}, "ITEMS": [{"HASHVAL": 341066122, "NAME": "Version:", "VALUE": "1.10.15.1-2", "READONLY": "TRUE", "CNAME": "version", "TYPE": "T_STRING_V1"}], "HASHLIST": [731341160, 2266556823, 1317704272, 116765155], "URI": "/menu_native/dynamic/tv_settings/admin_and_privacy/system_information/tv_information/version", "PARAMETERS": {"FLAT": "TRUE", "HELPTEXT": "FALSE", "HASHONLY": "FALSE"}}

RuntimeError: This event loop is already running

Getting the below traceback whenever I try setting a new input on my Vizio soundbar. I'm able to run input-get, input-list, etc. just fine, so communication itself seems to work fine. The model is a SB4551D.

Traceback (most recent call last):
  File "/home/nolan/.local/bin/pyvizio", line 11, in <module>
    load_entry_point('pyvizio==0.1.4', 'console_scripts', 'pyvizio')()
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/nolan/.local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/nolan/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/nolan/.local/lib/python3.7/site-packages/pyvizio/cli.py", line 248, in input
    result = vizio.input_switch(name)
  File "/home/nolan/.local/lib/python3.7/site-packages/pyvizio/vizio.py", line 556, in input_switch
    name, log_api_exception=log_api_exception
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/home/nolan/.local/lib/python3.7/site-packages/pyvizio/vizio.py", line 309, in input_switch
    cur_input = await self.get_current_input(log_api_exception=log_api_exception)
  File "/home/nolan/.local/lib/python3.7/site-packages/pyvizio/vizio.py", line 444, in get_current_input
    log_api_exception=log_api_exception
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 570, in run_until_complete
    self.run_forever()
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 525, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

Thanks.

Vizio Elevate sound bar volume control issue

Recently added an Elevate sound bar to HA using Discovery and the volume control is out of step. If I ask the integration to adjust volume using the slider the slider will go to my selection but snap back after a second. It snaps back to exactly 13 steps above or below the starting point. If I ask for volume 50 from 10 it will go up but only by 13 steps, I can ask it repeatedly until it gets close to 50 then it seems to settle on a number as close to 50 as possible i.e 48.
I can call service volume_set in Node-Red and the sound bar behaves well. Send volume_level .1 and it's at volume 10 (or 10%) on actual sound bar display but slider in HA says 13. If I send volume_level .6 the actual sound bar will arrive at 60 (or 60%) but the integration slider is at ~96%. If I send volume_level 1 my ear drums pop and it is level 100 (or 100%) on the actual sound bar and the integration slider is, of course, maxed out.
Adjusting step size in integration doesn't seem to help.

Thank you,

Failed to establish a new connection/ connection refused

I am new to github and very novice at coding so I apologize for any errors in my issue submission. I am trying to use pyvizio to connect to my soundbar (smartcast soundbar 3651-E6) for use with Hassio. I am able to find the soundbar using the ip address and the discover command but sending commands from hassio terminal, attempting to pair and my hassio configuration all results in the same error. Any help would be greatly appreciated.

ERROR:pyvizio.vizio:Failed to execute command: HTTPSConnectionPool(host='192.168.50.56', port=7345): Max retries exceeded with url: /key_command/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x106603c50>: Failed to establish a new connection: [Errno 111] Connection refused'))

Hassio config
media_player:

  • platform: vizio
    host: 192.168.50.56
    device_class: soundbar
    suppress_warning: true

volume-current command is broken

Looks like a recent Vizio Firmware update has broken the API calls related to Audio.

Calling "current-audio" results in the following error:
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): ...
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
ERROR:pyvizio.vizio:Failed to execute command: Failed to parse response: b'\n\n<title>Unhandled Exception</title>\n\n

Unhandled Exception

\n

An unhandled exception was thrown by the application.

\n\n'
INFO:pyvizio.cli:Current volume: None

Running a Curl command to get the raw output results in this:
/menu_native/dynamic/tv_settings/Audio
{"STATUS": {"RESULT": "URI_NOT_FOUND", "DETAIL": "URI not found"}, "URI": "/menu_native/dynamic/tv_settings/Audio"}
Also see the Unhandled Exception if I use lowercase audio in the URI.

Unable to pair via CLI

Working on trying to make a remote for my vizio tv. However when I tried to go to pair manually through the CLI I get this

PS C:\Windows\system32> pyvizio --ip={10.1.1.178:7345} --device_type={tv} pair At line:1 char:21
pyvizio --ip={10.1.1.178:7345} --device_type={tv} pair

Missing property name after reference operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName

I can pair just fine through the app but I dont get the auth token to try the CLI with.

Issues getting/setting various audio settings

According to the documentation, my sound bar has Music and Movie EQ settings.

$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 get-audio-setting eq
INFO:pyvizio.cli:Current 'eq' setting: Movie
$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 audio-setting eq Music
INFO:pyvizio.cli:Attemping to set 'eq' to 'Music'
INFO:pyvizio.cli:ERROR
$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 get-audio-setting eq
INFO:pyvizio.cli:Current 'eq' setting: Music

Not sure I hear a difference, though the sound bar does stutter a bit when the command is run.

$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 get-audio-settings-list
...
subwoofer
$ pyvizio --device_type=speaker --ip=192.168.0.217:9000 get-audio-setting subwoofer
ERROR:pyvizio.cli:Couldn't get value for 'subwoofer' setting

Thanks.

Many apps fail to launch using pyvizio

Several apps display a continually spinning white circle on black screen when launching using pyvizio on the command line.

As far as the apps that I use on a regular basis, I've seen this behavior on the Plex, Vudu, and Prime Video apps. Netflix, YouTube, and YouTubeTV work great.

I'll try to check all the apps as soon as I can get a chance and add more info to this ticket.

Stop working after 4/26

Starting on 4/26/2023 I am no longer able to connect to the tv from home assistant (other are having this issue too) and after looking even the base commands are not connecting. I tried removing and repair the device which worked but still getting the same error trying to pull info from the tv.

TV Verision: 7.0.120.1-1

pyvizio --ip {TV-IP} get-apps-list
Traceback (most recent call last):
File "/usr/local/bin/pyvizio", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pyvizio/helpers.py", line 13, in wrapper
return asyncio.run(f(args, **kwargs))
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/pyvizio/cli.py", line 631, in get_apps_list
apps = await VizioAsync.get_apps_list(country)
File "/usr/local/lib/python3.10/site-packages/pyvizio/init.py", line 726, in get_apps_list
apps_list = await gen_apps_list_from_url(session=session) or APPS
File "/usr/local/lib/python3.10/site-packages/pyvizio/util/init.py", line 46, in gen_apps_list_from_url
return gen_apps_list(app_names, app_configs)
File "/usr/local/lib/python3.10/site-packages/pyvizio/util/init.py", line 85, in gen_apps_list
config_json = app_config["chipsets"][""][0]["app_type_payload"]
KeyError: ''

Unable to change picture settings on one TV, but other settings work

I've encountered a strange issue involving changing only picture settings on one model (D32f-F1 from 2018). I am able to change settings in other categories without issues. I am also able to successfully change picture settings on a different model (E55-E2 from 2017).

When I try to get all picture settings from this TV, I receive this error:

matt@debian-server:~$ pyvizio --ip=10.0.2.47:7345 --device_type=tv --auth=deadbeef get-all-settings picture
ERROR:pyvizio:Failed to execute command: Failed to parse response: <StreamReader eof>
ERROR:pyvizio.cli:Couldn't get list of settings for picture setting type

I receive the same when trying to change a picture setting that works on the other TV.

Raw output from the picture settings endpoint on both TVs appears to be the same except for the minimum and maximum value for tint:

TV with issue:

matt@debian-server:~$ curl -k -H "Content-Type: application/json" -H "AUTH: DEADBEEF" -X GET https://10.0.2.47:7345/menu_native/static/tv_settings/picture
{"STATUS": {"RESULT": "SUCCESS", "DETAIL": "Success"}, "HASHVAL": 1234567890, "GROUP": "G_PICTURE", "NAME": "Picture", "PARAMETERS": {"FLAT": "TRUE", "HELPTEXT": "FALSE", "HASHONLY": "FALSE"}, "ITEMS": [{"CNAME": "picture_mode", "TYPE": "T_LIST_X_V1", "NAME": "Picture Mode"}, {"TYPE": "T_LIST_V1", "CNAME": "auto_brightness_control", "GROUP": "G_PICTURE", "NAME": "Auto Brightness Control", "ELEMENTS": ["Off", "Low", "Medium", "High"]}, {"GROUP": "G_PICTURE", "NAME": "Backlight", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "backlight", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Brightness", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "brightness", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Contrast", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "contrast", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Color", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "color", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"CNAME": "tint", "MINIMUM": -50, "GROUP": "G_PICTURE", "NAME": "Tint", "INCREMENT": 1, "INCMARKER": "Green", "DECMARKER": "Red", "TYPE": "T_VALUE_ABS_V1", "MAXIMUM": 50, "CENTER": 0}, {"GROUP": "G_PICTURE", "NAME": "Sharpness", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "sharpness", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"TYPE": "T_MENU_V1", "CNAME": "more_picture", "GROUP": "G_PICTURE", "NAME": "More Picture"}, {"TYPE": "T_MENU_V1", "CNAME": "picture_mode_edit", "GROUP": "G_PICTURE_MODE_EDIT", "NAME": "Picture Mode Edit"}, {"TYPE": "T_MENU_V1", "CNAME": "color_calibration", "GROUP": "G_COLOR_CALIBRATION", "NAME": "Color Calibration"}], "URI": "/menu_native/static/tv_settings/picture", "CNAME": "picture", "TYPE": "T_MENU_V1"}

TV without issue:

matt@debian-server:~$ curl -k -H "Content-Type: application/json" -H "AUTH: DEADBEEF" -X GET https://10.0.2.46:7345/menu_native/static/tv_settings/picture
{"STATUS": {"RESULT": "SUCCESS", "DETAIL": "Success"}, "HASHVAL": 1234567890, "GROUP": "G_PICTURE", "NAME": "Picture", "PARAMETERS": {"FLAT": "TRUE", "HELPTEXT": "FALSE", "HASHONLY": "FALSE"}, "ITEMS": [{"CNAME": "picture_mode", "TYPE": "T_LIST_X_V1", "NAME": "Picture Mode"}, {"TYPE": "T_LIST_V1", "CNAME": "auto_brightness_control", "GROUP": "G_PICTURE", "NAME": "Auto Brightness Control", "ELEMENTS": ["Off", "Low", "Medium", "High"]}, {"GROUP": "G_PICTURE", "NAME": "Backlight", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "backlight", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Brightness", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "brightness", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Contrast", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "contrast", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"GROUP": "G_PICTURE", "NAME": "Color", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "color", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"CNAME": "tint", "MINIMUM": -32, "GROUP": "G_PICTURE", "NAME": "Tint", "INCREMENT": 1, "INCMARKER": "Green", "DECMARKER": "Red", "TYPE": "T_VALUE_ABS_V1", "MAXIMUM": 32, "CENTER": 0}, {"GROUP": "G_PICTURE", "NAME": "Sharpness", "MAXIMUM": 100, "MINIMUM": 0, "CNAME": "sharpness", "INCREMENT": 1, "TYPE": "T_VALUE_V1"}, {"TYPE": "T_MENU_V1", "CNAME": "more_picture", "GROUP": "G_PICTURE", "NAME": "More Picture"}, {"TYPE": "T_MENU_V1", "CNAME": "picture_mode_edit", "GROUP": "G_PICTURE_MODE_EDIT", "NAME": "Picture Mode Edit"}, {"TYPE": "T_MENU_V1", "CNAME": "color_calibration", "GROUP": "G_COLOR_CALIBRATION", "NAME": "Color Calibration"}], "URI": "/menu_native/static/tv_settings/picture", "CNAME": "picture", "TYPE": "T_MENU_V1"}

Please let me know what else I can provide.

Some sources no longer work with Home Assistant

Note: I am not sure this is the right place, perhaps not. Not sure whether this is generic select source issue or an issue with pyvizio.

Some sources (specifically HDMI-1,2,3,4) as well as CAST no longer work with media_player.select_source

service: media_player.select_source
data:
source: HDMI-1
target:
entity_id: media_player.office_vizio

Worked up until the last Vizio update on newer TVs.
It is like select source works to select an app, but can't be used to change input.

Note that I have two V505-J09 which worked until Vizio update got installed. I have another Vizio (older) which had no update and it works perfectly. I can set source to HDMI-1, CAST, Netflix, etc and it will switch between those. After the update for the other TVs, yu can no longer use Home Assistant to switch between these sources.

In a quick test I can confirm that using select_source does not select any "inputs" now. From the HA state:

source_list:
HDMI-1
HDMI-2
HDMI-3
COMP
TV

All these no longer work, all other "apps" do. This also applies to CAST, you cannot get back to it after switching to something like Netflix. The code I use is all posted here which I cannot use anymore for these TVs:

https://github.com/kbrown01/Vizio_DirecTV

media_player.volume_set

Is there any hope for getting media_player.volume_set functionality on the Vizio SmartCast TV component?

Can't reach any endpoints with pyvizio, but can with curl

I have a Vizio E55-D0. I am able to reach endpoints and create an auth token via direct usage of curl, but cannot do so with pyvizio.

Below is an example (auth token redacted).

➜  pyvizio --ip=10.20.50.221 --device_type=tv --auth=XXXXXXXX power off
INFO:pyvizio.cli:Turning OFF
ERROR:pyvizio:Failed to execute command: Cannot connect to host 10.20.50.221:9000 ssl:False [None]
INFO:pyvizio.cli:ERROR

Any ideas from the devs? Is there any way to get more verbose output to understand what is happening?

Pyvizio fails to run

I have an openhab instance running in a virtual machine. I installed Pyvizio using "sudo pip3 install pyvizio". I get the following error when I try to discover devices.

sudo pyvizio --ip=0 discover

Traceback (most recent call last):
File "/usr/local/bin/pyvizio", line 7, in
from pyvizio.cli import cli
File "/usr/local/lib/python3.5/dist-packages/pyvizio/init.py", line 94
f"Invalid device type specified. Use either '{DEVICE_CLASS_TV}' or "
^
SyntaxError: invalid syntax

I’m not a programmer but I have done some python scripts so I know that I can get started if I can get pass this first issue.

Thanks

Vizio Crave 360?

This project worked great on my Vizio TV, thank you! Any plans to add support for the Vizio Crave 360 speaker?

I attempted the pairing process and its slightly different. When you initiate pairing with the speaker it makes an audible tone that you acknowledge by tapping the speaker (same way the smartcast app is paired). Your tool still gave a challenge token and referred to it as "Challenge type: 7". However with no pin for the cli tool the pairing process was not able to complete.

TV not discoverable

Hi. I am trying to use pyvizio but an unable to find my Vizio TV.

When doing pyvizio --ip=0 discover:

INFO:pyvizio:[]
INFO:pyvizio.cli:
IP Port Model Name

The TV is on a local IP address of 10.0.0.5.

arp -a shows an error under 10.0.05:\

? (10.0.0.5) at (incomplete) on en0 ifscope [ethernet]

Is there anything special I need to do to make my TV discoverable or do you have any information that may help?

CLI pairing instructions

In case you're interested, otherwise you can just close this issue.

I don't know how the discovery and config flow features in Home Assistant 0.105 will impact the setup steps, but it might be worthwhile to include CLI pairing instructions, either in this README or in the HA documentation.

I wrote this script a long time ago and haven't tested it recently, but it should still work. Obviously, VIZIO_IP will need to be modified, or you could prompt the user for it.

#!bin/bash

VIZIO_IP="192.168.0.15"
VIZIO_PORT="7345"

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

pvizio ImportError: cannot import name 'IPVersion' from 'zeroconf' (/usr/lib/python3.7/site-packages/zeroconf.py)

Hello,
Installed pyvizio on Fedora 31 using pip3 and have been unable to successfully run pyvizio;

$ pyvizio --ip=0 discover
Traceback (most recent call last):
File "/usr/local/bin/pyvizio", line 11, in
load_entry_point('pyvizio==0.1.21', 'console_scripts', 'pyvizio')()
File "/usr/lib/python3.7/site-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.7/site-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/usr/lib/python3.7/site-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/usr/lib/python3.7/site-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.7/site-packages/pyvizio/init.py", line 45, in
from pyvizio.discovery.zeroconf import ZeroconfDevice, discover as discover_zc
File "/usr/local/lib/python3.7/site-packages/pyvizio/discovery/zeroconf.py", line 5, in
from zeroconf import IPVersion, ServiceBrowser, ServiceInfo, Zeroconf
ImportError: cannot import name 'IPVersion' from 'zeroconf' (/usr/lib/python3.7/site-packages/zeroconf.py)

I verified all dependencies were met so, I'm not sure why this is occurring.
Python 3.7.6
pip(3) 20.0.2

$ pip install -U pyvizio
Requirement already up-to-date: pyvizio in /usr/local/lib/python3.7/site-packages (0.1.21)
Requirement already satisfied, skipping upgrade: aiohttp in /usr/local/lib64/python3.7/site-packages (from pyvizio) (3.6.2)
Requirement already satisfied, skipping upgrade: click in /usr/lib/python3.7/site-packages (from pyvizio) (7.0)
Requirement already satisfied, skipping upgrade: jsonpickle in /usr/local/lib/python3.7/site-packages (from pyvizio) (1.2)
Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3.7/site-packages (from pyvizio) (2.22.0)
Requirement already satisfied, skipping upgrade: tabulate in /usr/local/lib/python3.7/site-packages (from pyvizio) (0.8.6)
Requirement already satisfied, skipping upgrade: xmltodict in /usr/local/lib/python3.7/site-packages (from pyvizio) (0.12.0)
Requirement already satisfied, skipping upgrade: zeroconf in /usr/lib/python3.7/site-packages (from pyvizio) (0.23.0)
Requirement already satisfied, skipping upgrade: chardet<4.0,>=2.0 in /usr/lib/python3.7/site-packages (from aiohttp->pyvizio) (3.0.4)
Requirement already satisfied, skipping upgrade: async-timeout<4.0,>=3.0 in /usr/local/lib/python3.7/site-packages (from aiohttp->pyvizio) (3.0.1)
Requirement already satisfied, skipping upgrade: attrs>=17.3.0 in /usr/lib/python3.7/site-packages (from aiohttp->pyvizio) (19.1.0)
Requirement already satisfied, skipping upgrade: multidict<5.0,>=4.5 in /usr/local/lib64/python3.7/site-packages (from aiohttp->pyvizio) (4.7.4)
Requirement already satisfied, skipping upgrade: yarl<2.0,>=1.0 in /usr/local/lib64/python3.7/site-packages (from aiohttp->pyvizio) (1.4.2)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in /usr/lib/python3.7/site-packages (from requests->pyvizio) (2.8)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python3.7/site-packages (from requests->pyvizio) (1.25.7)
Requirement already satisfied, skipping upgrade: ifaddr in /usr/lib/python3.7/site-packages (from zeroconf->pyvizio) (0.1.6)

Unable to pair a Vizio e32-d1 tv

Hi my tv is detected by the script, however it is not able to start the pairing process.

Here are the current logs:

[twilight@Twilightop ~]$ pyvizio --ip=0 discover
/home/twilight/.local/pipx/venvs/pyvizio/lib/python3.11/site-packages/pyvizio/discovery/zeroconf.py:68: FutureWarning: ZeroconfListener({'_func': <function discover.<locals>.append_service at 0x7f3e36e179c0>}) has no update_service method. Provide one (it can be empty if you don't care about the updates), it'll become mandatory.
  ServiceBrowser(zeroconf, service_type, ZeroconfListener(append_service))
INFO:pyvizio:[ZeroconfDevice({'name': "Censored Bedroom TV", 'ip': '192.168.1.146', 'port': 9000, 'model': "Censored Bedroom TV", 'id': b'608916016'})]
INFO:pyvizio.cli:
IP               Port  Model             Name
-------------  ------  ----------------  ----------------
192.168.1.146    9000  Censored Bedroom TV  Censored Bedroom TV
[twilight@Twilightop ~]$ pyvizio --ip=192.168.1.146:9000 --device_type=tv pair
INFO:pyvizio.cli:Initiating pairing process, check your device for pin upon success
ERROR:pyvizio:Failed to execute command: Cannot connect to host 192.168.1.146:9000 ssl:False [None]
INFO:pyvizio.cli:ERROR
[twilight@Twilightop ~]$ 

How to enable Chromecast functionality on sound bar?

My SB3651-E6 Vizio Sound Bar has been acting up for a while and now I am unable to pair with the SmartCast app, either Android or iOS. However this magical library works just fine!

I use the remote and control the sound bar through the TV most of the time, but one feature that I cannot enable without the app is changing the name of the sound bar which seems to be what enables chromecast functionality, so I can cast audio from any device.

I have looked through the audio and system settings using pyvizio but have not found anything related to the name or enabling cast. Right now the sound bar is plugged to wired network and shows up on SmartCast but when hitting pair I'm asked to press the volume up, and the soundbar never makes the beep sound (it does on pyvizio), and instead just says failed to pair.

Any ideas on how to change name/enable chromecast? Thanks!

Docker submission

Would you be willing to create an official Docker build? Seems like it would be pretty strait forward, I just wouldn't want to step on your toes by making one, or fail to update something if and when this project needs updating.

Speaker (SP36512-F6) is discovered, but all commands are giving errror code 503

pyvizio --ip=0 discover
works and gives me correct output:
`IP Port Model Name


my.ip.output.here 9000 SB36512-F6 VIZIO SB36512`

however any commands, such as:
pyvizio --ip='my.ip.input.here:9000' device_type=speaker get-power-state
gives me this output:
ERROR:pyvizio:Failed to execute command: Device is unreachable? Status code: 503 INFO:pyvizio.cli:Device is off

I have tried with and without quotes on the IP and without the port. I am using the lastest version from pip. In the past the situation was reversed, as discover would not work, but commands would, unfortunately I cannot remember which version of pyvizio I was using at the time.

Any help would be amazing. I am very grateful for this project as this will be super useful to me. Thank you.

RuntimeError: Event loop is closed | when attempting pair

When trying to do a pair attempt (pyvizio --ip={ip:port} --device_type={device_type} pair) I keep getting a runtime error that closes the main loop.

Stack Trace:

INFO:pyvizio.cli:Initiating pairing process, check your device for pin upon success
INFO:pyvizio.cli:Challenge type: 1
INFO:pyvizio.cli:Challenge token: 208779
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000002251D4DC8B0>
Traceback (most recent call last):
File "c:\users"user"\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "c:\users"user"\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "c:\users"user"\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
self._check_closed()
File "c:\users"user"\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Can not discover Vizio TV

Hello -

Attempting to deploy on a Windows Server box that has Python installed and running.

When running the discover command

pyvizio --ip=0 discover Nothing is returned.....

I can ping the tv as shown below in the screen grab, any suggestions?

image

Thanks.

Squid

Adding support for opening TV apps (Netflix, Hulu, etc.)?

I recently noticed that the Vizio smartphone app (android) added support to open all the smart apps from within the app. I wouldn't mind figuring out how to add support myself, but I'm not quite sure where to start. Is there a good way to sniff the traffic between the app and the TV, or a list of commands that can be found in the APK?
Thanks!

Port Change Needed after Vizio Firmware Update

Vizio released software update 4.0.23.2 recently, and changed the port used to communicate with the TV from port 9000 to port 7345.

Using Port 9000 would result in errors similar to this pairing error: ERROR:pyvizio.vizio:Failed to execute command: HTTPSConnectionPool(host='[TV IP Address', port=9000): Max retries exceeded with url: /pairing/start (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:777)'),))

Changing to Port 7345 in protocol.py resolved the error.

tracemalloc RunTime Warning: no await in coroutine for get-remote-key-list

The coroutine in the get-remote-key-list method needs
await {coroutine}
to be implemented immediately following the call for get_remote_keys_list in order to function properly.
This issue is throwing the following runtime error:
sys:1: RuntimeWarning: coroutine 'get_remote_keys_list' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

That one liner is a fix for this issue.

ImportError: cannot import name 'asynccontextmanager'

Sorry this is probably not an issue with pyvizio per se but I can't figure out what I need to update to fix or a better place to ask the question, I realize the maintainer isn't very active. I've tried on 2 different computers running ubuntu; when I try to run pyvizio I get this error and was curious if anyone had a tip on what I need to upgrade to get this to work, here's the traceback:

File "/usr/local/bin/pyvizio", line 11, in
load_entry_point('pyvizio==0.1.24', 'console_scripts', 'pyvizio')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2693, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2324, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2330, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.6/dist-packages/pyvizio/init.py", line 6, in
from pyvizio._api._protocol import KEY_CODE, async_invoke_api, async_invoke_api_auth
File "/usr/local/lib/python3.6/dist-packages/pyvizio/_api/_protocol.py", line 10, in
from pyvizio.helpers import dict_get_case_insensitive
File "/usr/local/lib/python3.6/dist-packages/pyvizio/helpers.py", line 2, in
from contextlib import asynccontextmanager
ImportError: cannot import name 'asynccontextmanager'

Query for power state

Is there a simple way included in the library to query or get the power state of the TV? Did not see that mentioned in the sample\help doc. Thanks.

Shows unavailable inputs.

Inputs can be hidden from the input list through the TVs menus. Trying to change current_input to a hidden input won't work.

GET /menu_native/dynamic/tv_settings/devices/name_input includes hidden inputs. It would be better to GET /menu_native/dynamic/tv_settings/devices, as that only lists available inputs. The returned CUSTOM_NAME is what should be shown.

Also, my HDMI-1 input shows up in HASS as Source "Blu-ray", but in the pop-up for changing inputs it's "HDMI-1". If I change it to something else, then change it back, it's then shown as "HDMI-1". I'm not sure where the "Blu-ray" comes from, I didn't see it in a quick look at your code. /menu_native/dynamic/tv_settings/devices/name_input returns:

    {
        "CNAME": "hdmi1",
        "ENABLED": "FALSE",
        "HASHVAL": 1107326089,
        "NAME": "HDMI-1",
        "TYPE": "T_DEVICE_V1",
        "VALUE": {
            "METADATA": "",
            "NAME": "Denny"
        }

/menu_native/dynamic/tv_settings/devices returns

            {
                "CNAME": "hdmi1",
                "CUSTOM_NAME": "Denny",
                "INPUT_TYPE": 0,
                "METADATA": "",
                "NAME": "HDMI-1",
                "SELECTED": true,
                "TYPE": "T_INPUT_V2"
            },

current_input returns "VALUE": "HDMI-1"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.