Update bravia-tv backend (#34376)

* bravia-tv version bump

* Fix Auth Cookies

    - Fix authentication cookie expiration.
    - Remove obsolete error handling (since bravia-tv==1.0.2)
    - Remove obsolete mac address references. (since bravia-tv==1.0.2)
    - Update tests.

* fix async_refresh_playing_info

* Improve code format

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Config_entry needs mac address for HA restart

    This was mistakenly taken out. Home-Assistant needs to store mac address in
    case restarted. TV needs to be on to acquire mac address. This is neccesary
    to allow TV to be turned on by Home-Assistant after Home-Assistant is
    restarted.

* Skip update() during state changes

    It is best for performance to skip updates during state change because
    bravia.turn_on() will commonly push async_update() beyond it's update
    interval.

* update tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
David NielsenandMartin Hjelmare authored and GitHub committed 2020-04-21 16:46:12 +02:00
1 parent 60f79c848a
commit 08e74352ec
7 files changed
+78 -74

No files matched your search

@@ -89,7 +89,7 @@ async def test_import_model_unsupported(hass):
"""Test that errors are shown when the TV is not supported during import."""
with patch("bravia_tv.BraviaRC.connect", return_value=True), patch(
"bravia_tv.BraviaRC.is_connected", return_value=True
), patch("bravia_tv.BraviaRC.get_system_info", side_effect=KeyError):
), patch("bravia_tv.BraviaRC.get_system_info", return_value={}):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=IMPORT_CONFIG_IP,
)
@@ -150,7 +150,7 @@ async def test_authorize_model_unsupported(hass):
"""Test that errors are shown when the TV is not supported at the authorize step."""
with patch("bravia_tv.BraviaRC.connect", return_value=True), patch(
"bravia_tv.BraviaRC.is_connected", return_value=True
), patch("bravia_tv.BraviaRC.get_system_info", side_effect=KeyError):
), patch("bravia_tv.BraviaRC.get_system_info", return_value={}):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "10.10.10.12"},
)