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

Upgrade pychromecast to 1.0.3 #11410

Merged
merged 1 commit into from Jan 1, 2018

Conversation

OttoWinter
Copy link
Member

Description:

This is basically redoing the #10728 PR, which bumped pychromecast to 1.0.2. In a nutshell, the upgrade of pychromecast to 1.0.2 was supposed to fix an issue causing cast devices with never firmwares not being added to Home Assistant. But that fix introduces a new, probably even worse bug, that caused all cast devices to basically stop working - that bug, however, seems to have been fixed with 1.0.3.

In order to prevent a second google cast platform outage for Home Assistant, this time I asked for some feedback in #9965 before creating a new PR - and as far as I've heard, 1.0.3 seems to work fine.

Related issue (if applicable): fixes #11192, #11117, #9965

Checklist:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.

@balloob balloob merged commit b362017 into home-assistant:dev Jan 1, 2018
@balloob balloob mentioned this pull request Jan 11, 2018
@edif30
Copy link
Contributor

edif30 commented Jan 15, 2018

Does this also fix the google group (that is created in the home app) where the id will randomly change and HA is still holding onto the previous id? This would typically end in a failure and traceback and HA could not connect to the cast device.

@OttoWinter
Copy link
Member Author

@edif30 I don't think so. Sadly, I currently don't have my Chromecast Audios setup in order to reproduce your bug. But, looking at the commits since the last version, I don't see anything related to that problem.

On a side note: I haven't looked into it in detail, but I believe the problem you're describing is probably very hard, or even impossible to fix, since there's probably no way to distinguish between a cast device that is temporarily offline and a renamed audio group.

@jjanderson
Copy link

jjanderson commented Jan 18, 2018

HI, Just did the update and I am still experiencing issues. None of my cast devices are showing up.

I have 3 LG H51 and an SH6 Soundbar. I am using Home assistant in Docker (with host) on my Synology NAS

This was working before, but since all this change started none of my devices have reappeared.

We use this to service to notify us of medication times (for our nanny to give to our son) so this is rather frustrating that all this change has caused my devices to stop working…

The entries in my logs are as follows:

2018-01-15 17:13:58 ERROR (SyncWorker_3) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-01-15 17:13:59 ERROR (SyncWorker_17) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-01-15 17:13:59 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform cast is taking over 10 seconds.
2018-01-15 17:14:00 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform cast is taking over 10 seconds.

Please can someone help?

@OttoWinter
Copy link
Member Author

@jjanderson I agree, that's definitely not good to happen. So, if I understand correctly, all of your devices fail to show up in Home Assistant (i.e. they don't even appear and aren't just unresponsive). This makes me believe the error is caused by the changes in pychromecast/dial.py and your devices apparently not supporting the new /setup/eureka_info endpoint used for setup. But this is just a theory and I would like to know if it really is what's causing this - so could you maybe run these few commands on some machine with python installed and report the output? Thank you!

pip install -U pychromecast
python
> import pychromecast
> pychromecast.get_chromecasts()
> pychromecast.Chromecast('IP_OF_YOUR_CAST_DEVICE')

For an improved debugging experience it might be good to add some error logging statements here and here and not just ignore the connection errors completely. If my theory is correct (which would be quite weird, since the Google Home app uses the /setup/eureka_info endpoint for its discovery - and I would expect that app to work correctly) a fix might be quite easy and mostly already implemented (see OttoWinter/pychromecast@6e4dde7)

@jjanderson
Copy link

Hi,

Yes, none of my Chromecast devices (I even have an Android Phone with Cast receiver running which does not display) show up in Home Assistant, however I can see them on the network as well as discover them on Google Home Appication on my iPhone.

Do I need to run this command on the NAS or another linux machine with Python? Sorry, I very rarely venture into the CLI...

@jjanderson
Copy link

jjanderson commented Jan 18, 2018

successfully installed certifi-2018.1.18 protobuf-3.5.1 pychromecast-1.0.3 setuptools-38.4.0
xxxxxxxx@xxxxxxx:~$ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pychromecast
>>> pychromecast.get_chromecasts()
No handlers could be found for logger "pychromecast.socket_client"

@jjanderson
Copy link

There is definately something dodgy going on with cast.. and I am not the only one... https://community.home-assistant.io/t/media-player-not-appearing/8957

I would recommend annotating the cast component until all these bugs have been ironed out....

This whole issue is also a relativly hot topic at the moment which may or may not be related....

http://www.bbc.co.uk/news/technology-42745214

Regardless of if this is related or not, until such time as we (as a community) are 100% that a component is working, we shoud update (with a caveat) the notes in the component page... if we know there are issues, these should be called out, otherwise new users will simply lose faith in the prodct as a whole...

Be honest... This is a google issue, not yours... but instead of newbie's trying and failing to connect because of hardware, and then losing faith in HA, we should call it out that it is work in progress...

@OttoWinter
Copy link
Member Author

OttoWinter commented Jan 19, 2018

@jjanderson Firstly, to my understanding, that Chromecast/Google Home WiFi flooding issue is not related to this (trying to avoid terms like certainly here, as software bugs can always have some complicated causes - though this being the cause would be very unlikely).

I understand this bug needs to be fixed, and preferably quickly. I completely agree Home Assistant should support all devices without breaking anything - in fact, this version bump was specifically intended to do exactly that, fix Google Home devices that previously weren't showing up in Home Assistant. If many users are experiencing this problem, another roll back might sadly be the best option. Then, waiting for much more feedback and improving logging before trying another version bump would be good too.

Now, to fix the issue: I've gone over the diff of versions 0.8.2 and 1.0.3 of pychromecast and the only major change was the one in pychromcast/dial.py - which would support my previous theory. But, on the other hand, in the forum post you linked to you mentioned you were using discovery for cast. In that case, I would expect all the devices to work, because the changed code is only ever really needed when manually setting up a device via IP.

Thank you very much for running the commands - though they are sadly not as revealing as I hoped them to be. Well, could you maybe try to open this url in a browser and report the output? http://IP_OF_YOUR_CAST_DEVICE:8008/setup/eureka_info?options=detail (really all I need would be whether the page is reachable). It's really hard to figure out the cause of this bug because none of my devices are affected, but thank you so much for helping!

@OttoWinter
Copy link
Member Author

@jjanderson After lots of investigating, I believe this issue is not caused by my first theory, since, as you verified, the new endpoint works. Instead, I now think it is most likely caused by some complicated network interface stuff (of which I have very little knowledge, #11431 has an excellent description)...

I don't know if anybody has suggested this as a work-around yet, but you should still be able to override discovery by manually adding all the cast devices like this:

media_player:
  - platform: cast
    host: IP_OF_YOUR_CAST_FIRST_DEVICE
  - platform: cast
    host: IP_OF_YOUR_CAST_SECOND_DEVICE

Hope this helps.

@OttoWinter OttoWinter deleted the upgrade-pychromecast branch March 13, 2018 20:18
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chromecast not detected in certain conditions
5 participants