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 authored and GitHub committed 2020-05-15 11:09:21 -05:00
1 parent 92756f9b12
commit 7e56f2cc0e
5 files changed
+9 -6

No files matched your search

+3 -2
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."""
+2 -2
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"]
}
@@ -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)