mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Bump pychromecast to 7.2.0 (#38351)
This commit is contained in:
parent
1b593e3169
commit
e3dc8a1ff2
@ -1,16 +1,25 @@
|
|||||||
"""Config flow for Cast."""
|
"""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 import config_entries
|
||||||
from homeassistant.helpers import config_entry_flow
|
from homeassistant.helpers import config_entry_flow
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
from .helpers import ChromeCastZeroconf
|
||||||
|
|
||||||
|
|
||||||
async def _async_has_devices(hass):
|
async def _async_has_devices(hass):
|
||||||
"""Return if there are devices that can be discovered."""
|
"""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(
|
config_entry_flow.register_discovery_flow(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Google Cast",
|
"name": "Google Cast",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/cast",
|
"documentation": "https://www.home-assistant.io/integrations/cast",
|
||||||
"requirements": ["pychromecast==7.1.2"],
|
"requirements": ["pychromecast==7.2.0"],
|
||||||
"after_dependencies": ["cloud","zeroconf"],
|
"after_dependencies": ["cloud","zeroconf"],
|
||||||
"zeroconf": ["_googlecast._tcp.local."],
|
"zeroconf": ["_googlecast._tcp.local."],
|
||||||
"codeowners": ["@emontnemery"]
|
"codeowners": ["@emontnemery"]
|
||||||
|
@ -1253,7 +1253,7 @@ pycfdns==0.0.1
|
|||||||
pychannels==1.0.0
|
pychannels==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.cast
|
# homeassistant.components.cast
|
||||||
pychromecast==7.1.2
|
pychromecast==7.2.0
|
||||||
|
|
||||||
# homeassistant.components.cmus
|
# homeassistant.components.cmus
|
||||||
pycmus==0.1.1
|
pycmus==0.1.1
|
||||||
|
@ -589,7 +589,7 @@ pyblackbird==0.5
|
|||||||
pybotvac==0.0.17
|
pybotvac==0.0.17
|
||||||
|
|
||||||
# homeassistant.components.cast
|
# homeassistant.components.cast
|
||||||
pychromecast==7.1.2
|
pychromecast==7.2.0
|
||||||
|
|
||||||
# homeassistant.components.coolmaster
|
# homeassistant.components.coolmaster
|
||||||
pycoolmasternet==0.0.4
|
pycoolmasternet==0.0.4
|
||||||
|
@ -13,7 +13,9 @@ async def test_creating_entry_sets_up_media_player(hass):
|
|||||||
"homeassistant.components.cast.media_player.async_setup_entry",
|
"homeassistant.components.cast.media_player.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup, patch(
|
) 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(
|
result = await hass.config_entries.flow.async_init(
|
||||||
cast.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
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."""
|
"""Test that specifying config will create an entry."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.cast.async_setup_entry", return_value=True
|
"homeassistant.components.cast.async_setup_entry", return_value=True
|
||||||
) as mock_setup, patch(
|
) as mock_setup:
|
||||||
"pychromecast.discovery.discover_chromecasts", return_value=True
|
|
||||||
):
|
|
||||||
await async_setup_component(
|
await async_setup_component(
|
||||||
hass, cast.DOMAIN, {"cast": {"some_config": "to_trigger_import"}}
|
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."""
|
"""Test that no config will not create an entry."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.cast.async_setup_entry", return_value=True
|
"homeassistant.components.cast.async_setup_entry", return_value=True
|
||||||
) as mock_setup, patch(
|
) as mock_setup:
|
||||||
"pychromecast.discovery.discover_chromecasts", return_value=True
|
|
||||||
):
|
|
||||||
await async_setup_component(hass, cast.DOMAIN, {})
|
await async_setup_component(hass, cast.DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user