-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Add retry limit for chromecast connection #16471
Conversation
Tried it locally and it works. |
# pylint: disable=protected-access | ||
_LOGGER.debug("Connecting to cast device %s", cast_info) | ||
chromecast = await self.hass.async_add_job( | ||
pychromecast._get_chromecast_from_host, ( | ||
cast_info.host, cast_info.port, cast_info.uuid, | ||
cast_info.model_name, cast_info.friendly_name | ||
)) | ||
), CONNECTION_RETRY, CONNECTION_RETRY_WAIT, CONNECTION_TIMEOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw this PR while working through my mailbox. Before a chromecast rewrite it was done like with your new code. However, the problem with this change is that if the retry limit is exceeded (for example by plugging the CC out for a while), hass will no longer attempt to reconnect.
Anyway, I guess the only way to get rid of all these CC issues is to make pychromecast a bit more async aware. Either by converting it to asyncio (lots of work, trust me I tried) or by making use of the blocking
parameter.
* Revert changes of #16471, and fix the platform setup issue * Fix unit test * Fix * Fix comment * Fix test * Address review comment * Address review comment
Description:
Connect to chromecast fail will block whole HA startup
_get_chromecast_from_host
method accepttries
,retry_wait
,timeout
andblocking
parameters. But above code doesn't provided any one of them.timeout
default is 30s, and tries default isinfinite
.I don't have chromecast, need someone help to test this PR
Related issue (if applicable): fixes #14956
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: