Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix known_hosts for older chromecasts #762

Merged
merged 5 commits into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions pychromecast/dial.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,26 @@ def get_device_info( # pylint: disable=too-many-locals
try:
if services is None:
services = [ServiceInfo(SERVICE_TYPE_HOST, (host, 8009))]
_, status = _get_status(
services,
zconf,
"/setup/eureka_info?params=device_info,name",
True,
timeout,
context,
)

# Try connection with SSL first, and if it fails fall back to non-SSL
try:
domenipavec marked this conversation as resolved.
Show resolved Hide resolved
_, status = _get_status(
services,
zconf,
"/setup/eureka_info?params=device_info,name",
True,
timeout / 2,
context,
)
except (urllib.error.HTTPError, urllib.error.URLError):
_, status = _get_status(
services,
zconf,
"/setup/eureka_info?params=device_info,name",
False,
timeout / 2,
context,
)

cast_type = CAST_TYPE_CHROMECAST
display_supported = True
Expand All @@ -204,6 +216,8 @@ def get_device_info( # pylint: disable=too-many-locals
model_name = device_info.get("model_name", model_name)
manufacturer = device_info.get("manufacturer", manufacturer)
udn = device_info.get("ssdp_udn", None)
else:
udn = status.get("ssdp_udn", None)

if not display_supported:
cast_type = CAST_TYPE_AUDIO
Expand Down