GithubHelp home page GithubHelp logo

Comments (10)

Olshansk avatar Olshansk commented on May 10, 2024 1

I'm using version 0.7.7 of PyChromecast as specified in the requirements file.

I tried updating to the latest release (0.8.1) and am getting the following error instead ERROR:pychromecast.socket_client:Failed to connect, retrying in 5.0

I've only tried this with Wifi.

from mkchromecast.

Olshansk avatar Olshansk commented on May 10, 2024 1

tl;dr I got it to work by disabling AirServer but I also think we should set the tries argument in the pychromecast.get_chromecasts call.

Alright, I got it to work and have some interesting findings to share.

The reason it wasn't working is because I am running AirServer, which configures my laptop to be an AirPlay/Google Cast receiver. Disabling the Google Cast feature fixes the problem.

I haven't looked into the Google Cast protocol extensively, but it seems that AirServer's implementation is incomplete. Nmapping my google home and my chromecast shows that the two devices expose an http server on port 8008 and an ajp13 server on 8009. However, when I startup AirServer, while there is an ajp13 server on port 8009, nothing is exposed on 8008. This port is necessary to query the device status (see here), and returns an error otherwise. I also confirmed that a webserver on port is 8008 is indeed necessary according to this documentation.

The reason mkchromecast wasn't working is because the call to pychromecast.get_chromecasts here doesn't specify any configurations. This means that while pychromecast was able to successfully connect to two of my cast devices (home and chromecast), it failed to connect to my third cast device (airserver on laptop) and therefore never returns.

The fix is very simple: set the tries argument to something small when making the get_chromecasts call. This would prevent the underlying library from retrying to connect to server in perpetuity and return the fully functioning and available cast devices. A value of 1 or 2 is sufficient in my opinion.

If you think it's a good idea, I will hapilly make the PR.

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

Which version of pychromecast have you installed?. There are other people having similar issues (see https://github.com/balloob/pychromecast/issues?utf8=%E2%9C%93&q=No%20handlers%20could%20be%20found%20for%20logger%20) but I am not able to find any conclusive message. In some of the comments, it is mentioned that the cast object has to wait until the connection is fully setup. That is assured in mkchromecast/cast.py#L243.

Does this happen both in LAN and WiFi?.

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

I tried updating to the latest release (0.8.1) and am getting the following error instead ERROR:pychromecast.socket_client:Failed to connect, retrying in 5.0

One last question, is it only happening when using mkchromecast?. I used to have these problems before, and my wifi router was to blame. I might be wrong.

I've only tried this with Wifi.

Does it happen with the cable?

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

Were you able to solve this problem?. I still think is something related to your wifi router. Some time ago, there someone reported in #27 that was not able to cast anything through wifi and updating his wifi driver helped #27 (comment). Of course, I understand that in macOS that is not the case, but I haven't been able to reproduce this issue.

I had it before, and it was due to the router that was given to me by ISP.

from mkchromecast.

Olshansk avatar Olshansk commented on May 10, 2024

It is indeed only happening with mkchromecast and it doesn't work when I connect to the router via ethernet.

I'm planning to investigate more extensively but haven't gotten around to it yet.

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

That would be nice. Unfortunately, I haven't been able to reproduce it by myself.

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

Thanks for this information!. I also think it would be a good idea to set tries to some finite value. If you do the PR, could you add it as an option? in that way, users can turn it to original behavior when desired. All flags in mkchromecast are set here https://github.com/muammar/mkchromecast/blob/master/mkchromecast/__init__.py (no idea if it was the best way of doing so), I don't know what name we could choose for that flag maybe just --tries or something else?.

from mkchromecast.

Olshansk avatar Olshansk commented on May 10, 2024

Yup, that sounds good to me. I should have something up next weekend.

from mkchromecast.

muammar avatar muammar commented on May 10, 2024

Yup, that sounds good to me. I should have something up next weekend.

Thanks :).

from mkchromecast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.