1
mirror of https://github.com/home-assistant/core synced 2024-09-09 12:51:22 +02:00
Commit Graph

52 Commits

Author SHA1 Message Date
Raman Gupta
f0e0b41f77
Use entity attributes for vizio integration (#56093) 2021-09-27 20:20:15 +02:00
Marc Mueller
0815eede4b
Replace lists with tuples (2) (#53685) 2021-07-30 01:20:03 +02:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Ruslan Sayfutdinov
004fa63dbe
Use AddEntitiesCallback type, pt.3 (#49953) 2021-05-04 23:36:48 +02:00
Franck Nijhof
2ed386f9e6
Migrate to async_get_current_platform everywhere (#50034) 2021-05-03 09:34:28 -07:00
Milan Meulemans
29d72714f3
Replace dict with DeviceInfo (#49950)
* Replace dict with DeviceInfo

* Clean up

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-05-02 00:37:19 +02:00
jan iversen
6992e24263
Rename HomeAssistantType —> HomeAssistant, integrations t* - v* (#49544)
* Integration vizio: HomeAssistantType -> HomeAssistant.

* Integration velbus: HomeAssistantType -> HomeAssistant.

* Integration vacuum: HomeAssistantType -> HomeAssistant.

* Integration upnp: HomeAssistantType -> HomeAssistant.

* Integration upcloud: HomeAssistantType -> HomeAssistant.

* Integration twinkly: HomeAssistantType -> HomeAssistant.

* Integration tts: HomeAssistantType -> HomeAssistant.

* Integration tradfri: HomeAssistantType -> HomeAssistant.

* Integration traccar: HomeAssistantType -> HomeAssistant.

* Integration tplink: HomeAssistantType -> HomeAssistant.
2021-04-22 10:53:57 -04:00
Marc Mueller
b67b9b94f9
Update typing 13 (#48077) 2021-03-18 14:43:52 +01:00
Raman Gupta
783e0f9a14
Setup config entry even if vizio device is unreachable (#46864) 2021-02-24 20:15:47 +01:00
Raman Gupta
b651f63ef0
Suppress vizio logging API call failures to prevent no-op logs (#44388) 2021-01-01 13:35:05 +01:00
springstan
a2c3c33b22
Use core GitHub URL in all files (#41089) 2020-10-03 00:04:11 +02:00
Raman Gupta
100d2369d5
Use async_on_remove for vizio listeners (#40185) 2020-09-17 20:13:40 -05:00
Raman Gupta
7ff633f531
Automatically update app list for Vizio SmartTV's (#38641) 2020-09-02 11:55:10 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Raman Gupta
fbf44b37a9
Simplify vizio unique ID check since only IP and device class are needed (#37692) 2020-08-12 16:50:36 +02:00
Raman Gupta
0d5e279509
Standardize Vizio update service schema (#38636)
* update voluptuous schema to match standards and to handle data transformations

* improve test
2020-08-07 21:29:54 -05:00
Raman Gupta
297dd9bbc2
Add vizio service to update a device setting (#36739)
* track all settings and add service to update a setting

* sort setting types

* reduce frequency of updates due to the increase in API calls per update

* change dict call to a get in case audio settings aren't available

unlikely to occur but less error prone

* Update if statement to be more consistent

* revert changes to track all settings and store in state machine

* revert one more change

* force setting_type and setting_name to lowercase to make it easier to understand how to make service call

* make service calls even simpler by attempting to transform certain parameters as much as possible
2020-08-06 22:43:03 -04:00
Raman Gupta
572d5a09cd
Vizio: when checking new host against existing config entry hosts, make check hostname aware (#37397)
* make ip check hostname aware

* add executor job for sync function doing IO and remove errant comma

* revert change to update new_data explicitly for options keys since it is already done later

* empty commit to retrigger CI
2020-07-08 15:31:41 -04:00
Raman Gupta
cd054a9579
clean up code to improve consistency and revert previous change (#35752) 2020-05-31 10:03:11 +02:00
Raman Gupta
eec1b3e7a7
Reduce Vizio API calls (#35726)
* reduce calls to API

* get apps list every time

* fix typo
2020-05-17 12:13:53 +02:00
Raman Gupta
3e06e6b4b3
Don't attempt to set Vizio is_volume_muted property if Vizio API doesn't provide muted state (#34782) 2020-04-30 21:05:45 -07:00
Erik Montnemery
62bc02fdda
Rename MediaPlayerDevice to MediaPlayerEntity (#34592) 2020-04-25 18:00:57 +02:00
Raman Gupta
081b822d25
Add support for Vizio sound mode (#33200)
* add sound mode support for devices that support it

* make setting and unsetting flag better

* move eq and audio settings into constants

* fix missed statement to use constant instead of hardcoded string

* further fixes based on review

* bump pyvizio version to include newly identified app
2020-04-02 22:48:19 -04:00
Raman Gupta
d5f4dfdd6b
Update vizio app_id state attribute to show app config dict in… (#32727)
* bump pyvizio and update app_id to show app config to aid in HA config generation. squashed from multiple commits to make a rebase on dev easier

* bump pyvizio for bug fixes

* fix pyvizio version number

* only return app_id if app is unknown and explicitly create the dict that's returned

* fix tests

* fix docstring for app_id
2020-03-25 09:35:36 -07:00
Raman Gupta
ca3a22b5a3
Filter out duplicate app names from vizio's source list (#33051)
* filter out additional app config names from pyvizios app list

* add test

* change where filtering app list occurs

* fix test

* fix mistake in change

* hopefully final test fix

* fix test scenario that unknowingly broke with test change
2020-03-22 17:34:00 +01:00
Raman Gupta
26d7b2164e
Move apps configuration to options flow for vizio integration (#32543)
* move apps configuration to options flow

* add additional assertion to new test

* add additional assertions for options update

* update docstrings, config validation, and tests based on review
2020-03-13 12:16:24 +01:00
Raman Gupta
6e97975ff8
Set self._current_app to None when vizio device is off (#32725) 2020-03-12 15:04:34 +01:00
Raman Gupta
77ebda0c20
Update Vizio source property to only return current app if i… (#32713)
* only return current app for source if current app is set

* check for None specifically

* make sure current app isn't called for speaker
2020-03-12 11:01:05 +01:00
Paulus Schoutsen
a579fcf248
Add app support for TVs to Vizio integration (#32432)
* add app support

* code cleanup, add additional test, add CONF_APPS storage logic for import

* simplify schema defaults logic

* remove unnecessary lower() and fix docstring

* remove default return for popping CONF_APPS during import update because we know entry data has CONF_APPS due to if statement

* further simplification

* even more simplification

* fix type hints

* move app configuration to separate step, fix tests, and only make app updates if device_type == tv

* remove errors variable from tv_apps and move tv_apps schema out of ConfigFlow for consistency

* slight refactor

* remove unused error from strings.json

* set unique id as early as possible

* correct which dictionary to use to set unique id in pair_tv step
2020-03-05 13:34:12 -08:00
Raman Gupta
4f619691df
Add is_volume_muted property to vizio integration (#32332)
* add is_muted property and update tests

* black

* manually set is_muted on async_mute_volume calls to set state early

* combine two lines into one

* set is_muted to None when device is not on
2020-03-04 10:04:52 +01:00
Raman Gupta
4236d62b44
Improve Vizio fix to avoid KeyError (#32163)
* dont set default volume_step on import check

* ensure config entry data['volume_step'] is set

* consolidate entry update during entry setup
2020-02-24 19:35:28 -08:00
Raman Gupta
7a6b13cb0d
Update vizio dependency and integration name (#31975)
* bump pyvizio version and clean up code

* fix requirements

* update parameter to optional per review in docs PR
2020-02-20 08:43:29 -08:00
Raman Gupta
ee927fbc9e
Bump pyvizio version and add additional device info (#31417)
* bump pyvizio version and add additional device info

* add patches for get_model and get_version

* change keywrod argument to positional for _test_service
2020-02-03 08:41:58 +01:00
Raman Gupta
a0067a298a
Remove Throttle on async_setup and bump pyvizio version (#31337) 2020-01-31 12:45:23 +01:00
Raman Gupta
73ea34e417
Update media_player and add tests to qualify vizio integration for platinum quality score (#31187)
* add media player test and update media player logic to qualify vizio for platinum quality score

* add SCAN_INTERVAL and log message once when device goes from available to unavailable and vice versa

* move test constants into one file to avoid defining dupes in each test file

* move constant to shrink diff

* move pytest fixtures to conftest.py

* remove commented out code

* move unload test to test_init

* updates to tests and logging based on review

* bypass notification service

* add fixture so component setup makes it through config flow

* split failure tests into two

* fix setup and entity check for test_init and setup failures in test_media_player

* make domain references consistent across test files

* remove logging steps that were introduced to help debug

* move common patches out to new fixture and use config entry everywhere appropriate

* fix docstring

* add test for update options to increase code coverage

* add one more assert

* refactor test_media_player to move boiler plate logic out of each test into _test_init function

* final refactor of test_media_player to move repeat logic into separate function

* update docstrings

* refactor setup failure tests to move shared logic into private function

* fix last new functions code to use variable instead of static config variable

* remove trailing comma

* test that volume_step gets properly passed to Vizio volume function

* fix comment language

* assert with unittest.mock.call in _test_service and use config_entries.async_setup instead of config_entries.async_add

* replace config_entries.async_add with config_entries.async_setup everywhere

* simplify if statement for argument assertion

* fix logging based on style guide

* remove accidentally committed changes

* update scan interval to something more reasonable and add tests for availability changes

* change filter function to list comprehension, simplify log messages, remove default entity id from logs since it is user configurable, fix docstrings
2020-01-30 22:13:45 +01:00
Raman Gupta
1de003487e Fix connection failure log message in async_setup_entry for Vizio component (#31097)
* remove connection check during setup since it is already done during config flow

* revert change and fix log message

* demote connection setup to warning
2020-01-24 07:39:28 +01:00
Raman Gupta
192b656635 Code Cleanup for Vizio component (#31076)
* code cleanup

* dont use named arguments for positional arguments

* remove extra comma
2020-01-23 01:55:34 +01:00
Raman Gupta
463d949ee0 Add zeroconf discovery support for vizio integration (#30949)
* add missing tests

* readd removed test

* add zeroconf discovery support for vizio integration

* no mock_coro_func needed

* add reasonable timeout and don't log exceptions from pyvizio due to timeout

* add test to test options update and bump pyvizio to avoid timeout issues

* update requirements_*

* fix gaps in coverage

* change return hint for async_setup_entry

* use source variables instead of strings

* only get unique ID if about to create entry

* update based on review

* Revert "update based on review"

This reverts commit 0d612a90eb7d02c92061f902973e527267e3110a.

* f-string

* fix last review

* revert cleanup changes to simplify PR

* remove unnecessary ConfigFlow object variables to simplify logic

* revert cleanup changes to make review easier, noted for future cleanup

* revert cleanup changes to make review easier, noted for future cleanup

* move zeroconf service type constant to test module
2020-01-22 10:13:35 +01:00
Raman Gupta
8630a076a7 Use default media player device classes for vizio component (#30802)
* use media player defined device classes instead of custom ones, add options flow test, add timeout options parameter

* make options update error more generic

* fix config flow options update logic

* simplify logic for options update during import

* use platform list for load and unload

* update private config flow function name and description

* fix grammar in strings.json

* update mock config variable names to be more accurate

* remove timeout conf option, create device_class property

* update requirements

* update .coveragerc to indicate that config_flow has tests

* fix source of device_class property and move constants to const.py

* fix grammar in error message

* remove redundant device check in async_setup_entry since device connection is checked during config flow

* revert change to async_setup_entry, raise ConfigEntryNotReady if device can't be connected to

* update error text

* add more context to error text
2020-01-18 09:15:05 +01:00
Raman Gupta
ac771addc1 Add Config Flow support, Device Registry support, available property to vizio component (#30653)
* add config flow support, device registry support, available property

* raise PlatformNotReady if HA cant connect to device

* remove test logging statement and fix integration title

* store import and last user input values so user can see errors next to value that caused error

* add PARALLEL_UPDATES

* add missing type hints

* add missing type hints to tests

* fix options config flow title

* changes based on review

* better key name for message when cant connect

* fix missed update to key name

* fix comments

* remove logger from test which was used to debug and update test function names and docstrings to be more accurate

* add __init__.py to vizio tests module

* readded options flow and updated main component to handle options updates, set unique ID to serial, fixes based on review

* pop hass.data in media_player unload instead of in __init__ since it is set in media_player

* update requirements_all and requirements_test_all

* make unique_id key name a constant

* remove additional line breaks after docstrings

* unload entries during test_user_flow and test_import_flow tests to hopefully reduce teardown time

* try to speed up tests

* remove unnecessary code, use event bus to track options updates, move patches to pytest fixtures and fix patch scoping

* fix comment

* remove translations from commit

* suppress API error logging when checking for device availability as it can spam logs

* update requirements_all and requirements_test_all

* dont pass hass to entity since it is passed to entity anyway, remove entity unload from tests, other misc changes from review

* fix clearing listeners

* use config_entry unique ID for unique ID and use config_entry entry ID as update signal

* update config flow based on suggested changes

* update volume step on config import if it doesn't match config_entry volume step

* update config_entry data and options with new volume step value

* copy entry.data and entry.options before updating when updating config_entry

* fix test_import_entity_already_configured
2020-01-15 11:43:55 +01:00
Raman Gupta
d25aa1f183 Convert vizio component from sync to async component (#30605)
* add device_info property and move component to async

* use new VizioAsync class to have proper async support

* remove hass from VizioDevice init since it is not needed

* update requirements_all

* missed type hint

* updates based on review

* pyvizio version bump

* additional fixes based on review

* mistake in last commit

* remove device_info property because it can't be used unless this integration has config flow support
2020-01-10 03:53:47 +01:00
Raman Gupta
a9f6dd698e Remove suppress_warning from config options for vizio component (#30536)
* move constants, move schema validation to init, prepare for zeroconf/config flow

* mistake in refactor

* update .coveragerc, move validate_auth to __init__, only attempt to get ESN if device setup is validated

* fix schema validation

* remove suppress warning config option

* remove config_flow from manifest since its not ready yet

* update requirements_all.txt

* fix issue with merge conflict
2020-01-07 13:31:13 +01:00
Raman Gupta
7d58de1bda Update vizio component to prepare for config flow and zeroconf support (#30522)
* move constants, move schema validation to init, prepare for zeroconf/config flow

* update requirements_all and make setup validation more pythonic

* mistake in refactor

* un-revert change from previous PR

* rename schema var

* update .coveragerc, move validate_auth to __init__, only attempt to get ESN if device setup is validated

* reinstate validate_setup but change logic to use new connection test function

* fix schema validation

* simplify string empty check logic

* missed commit
2020-01-06 20:32:31 -05:00
Raman Gupta
2ac5862eda Add unique id property for Vizio devices so they get added to entity registry (#30497)
* add unique id property for Vizio devices so they get added to entity registry

* update requirements

* small change to make code more readable

* update to use f-string for consistency

* fix property name

* set unique_id to none if serial number couldnt be found

* set unique_id to none

* ESN should be globally unique so no device type needed. pyvizio will set ESN to None if ESN is unobtainable
2020-01-05 11:20:06 +01:00
Quentame
193769c791 Move vizio imports at top-level (#29046) 2019-11-25 14:05:46 +01:00
Quentame
3d05228ec1 Move imports in vizio component (#27452) 2019-10-12 14:09:39 +02:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Jeff Irion
4844477d3a Make sure volume level is valid when incrementing/decrementing (#25061)
* Make sure volume level is not None before incrementing/decrementing

* Pass linting checks
2019-07-10 15:58:29 -07:00
Raman Gupta
620c6a22ac Update vizio component to support latest pyvizio with soundbar support (#22294)
* update vizio component to support latest pyvizio with soundbar support

* Resolved Hound issues

* Additional Hound issue

* Updated based on feedback

* Style updates

* Additional code styling changes

* Added check for auth token not being set for tv device_class

* Limited lines to 80 characters

* moved MAX_VOLUME into base package

* fixed supported commands

* styling changes

* fix styling yet again

* remove unnecessary elif

* removed play/pause since I can't get current state

* changed value access method from config dict

* fixed flake failures

* try to fix docstring

* try to fix docstring

* fixed auth token validation

* rebase and regenerate requirements_all.txt

* updated log text

* line length fix

* added config validation to handle conditionally optional parameter

* updated validate setup log message and string formatting based on review

* fix pylint error

* less ugly
2019-04-18 22:48:05 +02:00
cgtobi
2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2c.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00