Bump pychromecast to 7.2.0 (#38351)

This commit is contained in:
Erik Montnemery 2020-07-29 23:46:14 +02:00 committed by GitHub
parent 1b593e3169
commit e3dc8a1ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 12 deletions

View File

@ -1,16 +1,25 @@
"""Config flow for Cast."""
from pychromecast.discovery import discover_chromecasts
import functools
from pychromecast.discovery import discover_chromecasts, stop_discovery
from homeassistant import config_entries
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
from .helpers import ChromeCastZeroconf
async def _async_has_devices(hass):
"""Return if there are devices that can be discovered."""
return await hass.async_add_executor_job(discover_chromecasts)
casts, browser = await hass.async_add_executor_job(
functools.partial(
discover_chromecasts, zeroconf_instance=ChromeCastZeroconf.get_zeroconf()
)
)
stop_discovery(browser)
return casts
config_entry_flow.register_discovery_flow(

View File

@ -3,7 +3,7 @@
"name": "Google Cast",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/cast",
"requirements": ["pychromecast==7.1.2"],
"requirements": ["pychromecast==7.2.0"],
"after_dependencies": ["cloud","zeroconf"],
"zeroconf": ["_googlecast._tcp.local."],
"codeowners": ["@emontnemery"]

View File

@ -1253,7 +1253,7 @@ pycfdns==0.0.1
pychannels==1.0.0
# homeassistant.components.cast
pychromecast==7.1.2
pychromecast==7.2.0
# homeassistant.components.cmus
pycmus==0.1.1

View File

@ -589,7 +589,7 @@ pyblackbird==0.5
pybotvac==0.0.17
# homeassistant.components.cast
pychromecast==7.1.2
pychromecast==7.2.0
# homeassistant.components.coolmaster
pycoolmasternet==0.0.4

View File

@ -13,7 +13,9 @@ async def test_creating_entry_sets_up_media_player(hass):
"homeassistant.components.cast.media_player.async_setup_entry",
return_value=True,
) as mock_setup, patch(
"pychromecast.discovery.discover_chromecasts", return_value=True
"pychromecast.discovery.discover_chromecasts", return_value=(True, None)
), patch(
"pychromecast.discovery.stop_discovery"
):
result = await hass.config_entries.flow.async_init(
cast.DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -34,9 +36,7 @@ async def test_configuring_cast_creates_entry(hass):
"""Test that specifying config will create an entry."""
with patch(
"homeassistant.components.cast.async_setup_entry", return_value=True
) as mock_setup, patch(
"pychromecast.discovery.discover_chromecasts", return_value=True
):
) as mock_setup:
await async_setup_component(
hass, cast.DOMAIN, {"cast": {"some_config": "to_trigger_import"}}
)
@ -49,9 +49,7 @@ async def test_not_configuring_cast_not_creates_entry(hass):
"""Test that no config will not create an entry."""
with patch(
"homeassistant.components.cast.async_setup_entry", return_value=True
) as mock_setup, patch(
"pychromecast.discovery.discover_chromecasts", return_value=True
):
) as mock_setup:
await async_setup_component(hass, cast.DOMAIN, {})
await hass.async_block_till_done()