Update cast to use shared zeroconf (#35570)

* Update cast to use the shared zeroconf instance

* Add zeroconf to after_dependencies

* Bump version to 5.2.0
This commit is contained in:
J. Nick Koston 2020-05-15 11:09:21 -05:00 committed by GitHub
parent 92756f9b12
commit 7e56f2cc0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 6 deletions

View file

@ -85,9 +85,10 @@ def setup_internal_discovery(hass: HomeAssistant) -> None:
_LOGGER.debug("Starting internal pychromecast discovery.")
listener, browser = pychromecast.start_discovery(
internal_add_callback, internal_remove_callback
internal_add_callback,
internal_remove_callback,
ChromeCastZeroconf.get_zeroconf(),
)
ChromeCastZeroconf.set_zeroconf(browser.zc)
def stop_discovery(event):
"""Stop discovery of new chromecasts."""

View file

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

View file

@ -14,6 +14,7 @@ from pychromecast.socket_client import (
)
import voluptuous as vol
from homeassistant.components import zeroconf
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MOVIE,
@ -170,6 +171,7 @@ async def _async_setup_platform(
for chromecast in list(hass.data[KNOWN_CHROMECAST_INFO_KEY]):
async_cast_discovered(chromecast)
ChromeCastZeroconf.set_zeroconf(await zeroconf.async_get_instance(hass))
hass.async_add_executor_job(setup_internal_discovery, hass)

View file

@ -1242,7 +1242,7 @@ pycfdns==0.0.1
pychannels==1.0.0
# homeassistant.components.cast
pychromecast==5.1.0
pychromecast==5.2.0
# homeassistant.components.cmus
pycmus==0.1.1

View file

@ -527,7 +527,7 @@ pyblackbird==0.5
pybotvac==0.0.17
# homeassistant.components.cast
pychromecast==5.1.0
pychromecast==5.2.0
# homeassistant.components.coolmaster
pycoolmasternet==0.0.4