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

Enabling cast integration causes Audible app to be unable to cast to Google devices #87387

Open
konstantinozh opened this issue Feb 4, 2023 · 22 comments
Assignees

Comments

@konstantinozh
Copy link

konstantinozh commented Feb 4, 2023

The problem

This is a strange one. The Audible app on Android supports casting to Google devices. However, if the cast integration is enabled in HA, Audible is no longer able to cast to the devices which now are available in Home Assistant. The Audible app simply times out when trying and gives up.

If the integration is deleted in HA, the Audible app is able to cast to those devices again. I've recreated this multiple times.

A workaround is available where you start the Audible app and then cast the device sound using the Google Home app, this works. But the native Audible cast function remains broken as long as this integration is active.

What version of Home Assistant Core has the issue?

2023.1.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Google Cast

Link to integration documentation on our website

https://www.home-assistant.io/integrations/cast

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Feb 4, 2023

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (cast) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of cast can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign cast Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


cast documentation
cast source
(message by IssueLinks)

@PereViader
Copy link

Just had this happen to me today. Running 2023.1.7 right now.
When trying to cast audible it gets stuck.
No problems with any other casting app.
Will update to latest and post if it gets fixed

@konstantinozh
Copy link
Author

Just updated to 2023.2.5 and can confirm it is still a problem

@ronnyek
Copy link

ronnyek commented May 9, 2023

I too just ran into this, and its literally only with the audible app. I'd be nice to be able to have this cast plugin enabled whilst being able to continue to cast with audible app

@PereViader
Copy link

PereViader commented May 9, 2023

Tested it again and can confirm it's still a problem

I just sent audible an email explaining a step by step repro of the issue and a link to this issue.
I'd suggest that everyone that wants this fixed also sends it their way.

@dzegarra
Copy link

dzegarra commented Jun 5, 2023

It never occurred to me that the problem was produced by HASS Google Cast integration.
I just disabled one of my Google Home Mini speakers and tried to cast from Audible to it, and it worked!

One google speaker disabled from HASS Google Cast integration

How could I help you debug this issue @emontnemery ?

@xenoputtss
Copy link

I found this issue because I was searching this exact same problem. I am able to reproduce the issue locally.

The issue appears to be something with the initial connection when beginning to cast. It affects individual devices and also groups of devices.

I was able to "get it working" by restarting my home assistant and while it was down initiating a casting using audible. Now that everything is playing and HomeAssistant is running it all seems to be working. If I disconnect from casting, I am unable to recast until I restart HA again.

I hope this can help narrow things down a little bit.

@bmac6996
Copy link

bmac6996 commented Aug 7, 2023

Would like to add to this issue. XM Radio app would not be able to cast to any my cast devices until i disabled my Cast integration in HA and rebooted. Then i was able to cast XM radio. Would have to disconnect XM radio, turn on integration and restart to get that working again on HA, but my XM radio cannot cast anymore.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@dzegarra
Copy link

dzegarra commented Nov 6, 2023

Had anyone tried if the issue was finally fixed in any of the last updated?

@PereViader
Copy link

Hello, the issue is still present on the latest versions
Core 2023.11.1
Supervisor 2023.10.1
Operating System 11.1
Frontend 20231030.1

@egandro
Copy link

egandro commented Nov 24, 2023

I can confirm that.

@HikariNoKitsune
Copy link

Issue definitely still exists... I've never been able to use the casting function of audible since day 1 of using HA over 2 years ago now... First I just thought that casting wasn't possible with audible, but now I've found this and after turning off HA, I can connect... Turning HA back on, and I can't connect anymore...

Never would have thought that HA was the problem all this time... I just thought it was cause my chrome cast goes into a sound bar and then into the TV, and have just not cared enough to try directly plugging in to the TV...

Makes me both glad, and disappointed however... Glad because now I know what the problem is... Disappointed because this has been an apparent issue for going on 2+ years for me...

@JanderII
Copy link

The issue definitely exists in the most recent version. My wife got Audible last night and went to cast it but to no avail. The Nest Mini made its connection noise but no actual audio stream. The Audible app thought it was connected but, oddly, the audio still came out of her phone.

@geoffoxholm
Copy link

geoffoxholm commented Dec 24, 2023

To work around this, I used a few services from Spook. But none were successful. They all successfully stopped the Cast integration from blocking Audible from casting (making it possible to cast from my Andriod device); But they did not recover well: turning the entity / device / integration back on did not restore the functionality of the entities within Home Assistant.

  • homeassistant.disable_entity / homeassistant.enable_entity - This worked to enable casting, but then the entity did not come back online when enable_entity was used.
  • homeassistant.disable_device / homeassistant.enable_device - Same issue as with above, the entities never returned to a usable state in HA
  • homeassistant.disable_config_entry / homeassistant.enable_config_entry - Fully disabling the Cast integration resulted in a bad state for the integration. It says: "Failed to onload". Calls to enable_config_entry report failure due to the configuration entry (Integration) being in a bad state.

In order to recover these entities I believe I need to reload Home Assistant.

I was hoping to make a template-switch to "Enable Audible Casting" by temporarily disabling the speaker we usually want to listen to books on, but this investigation just resulted in a bunch of things that don't work.


Separately, I also tried setting up a dummy Chromecast device, and blocking it from HA. I can (as others noted) cast to the device, but I can not then move the listening experience to another (HA-managed) device using the Google Home App. I was hoping to work around this by utilizing the Google Home ability to add / remove (join / un-join) speakers from an active Cast session. As soon as I added one of the speakers that HA has an active entity for, the cast stopped in Audible.

@aryasenna
Copy link

Is there a better workaround than simply disabling the integration?

Still the same issue with HA 2024.1.3

@Neowonder
Copy link

The issue unfortunately still persists in HA 2024.2.2.

Please, somebody solve this.

@linkian19
Copy link

Adding my comment in the ring for this as well. I'm on Home Assistant Core 2024.3.1 and this impact both myself and my wife who does NOT have access to HA (yet) or the companion app installed on her phone.

Can confirm, disabling the Google Home Mini in HA will allow it to work. I'm happy to pull any logs or anything that might help if requested.

@geoffoxholm
Copy link

geoffoxholm commented Mar 24, 2024

I've been able to reproduce the issue in the devcontainer. However, when I set breakponits in pychromecast I haven't been able to reproduce it.

I have no idea if this is a valid hypothesis, but I imagine that something like this is happening:

  1. Audible initiates a connection, and waits for an acknowledgement message;
  2. pychromecst sees the connection start, and issues a request to add a listener (or whatever it's doing);
  3. The actual chromecast responds to pychromecast before Audible
  4. Audible gets an unexpected message from the chromecast and its handshake fails

If a breakpoint delays step 2 then the Chomecast will respond with the message that Audible expects, and everything is fine. Once the cast is started, pychromecast being alive doesn't seem to disrupt the cast session. The issue is only in the initiation of the cast.

@geoffoxholm
Copy link

Following up, by adding

time.sleep(2) # Sleep for 2 seconds before ingesting update

Here:
https://github.com/home-assistant-libs/pychromecast/blob/b2e3c9dd4c554d50d1f526415d31c453c5dd391e/pychromecast/controllers/receiver.py#L112

Fixes the issue for me.

@Neowonder
Copy link

Following up, by adding

time.sleep(2) # Sleep for 2 seconds before ingesting update

Here: https://github.com/home-assistant-libs/pychromecast/blob/b2e3c9dd4c554d50d1f526415d31c453c5dd391e/pychromecast/controllers/receiver.py#L112

Fixes the issue for me.

Could you please elaborate? How exactly do I do this? I am not able to find "pychromecast" anywhere in my HA installation. Do I need to install it first? Is it different from Google Cast integration? Thanks so much in advance for your advice and patience!

@geoffoxholm
Copy link

Could you please elaborate? How exactly do I do this?

I'm sorry to say that what I found is not really an actionable "fix". I should not have said "Fix".

The code-edit that I made is too invasive, at the wrong level of of the API, but it does help diagnose the problem.

I also don't know how to deploy my work-around in a production environment. To get it working in the devcontainer I had to:

  • clone pychromecast
  • make the code change
  • pip install -e pychromecast (install the code-edited version locally)
  • Start HACS with --skip-pip (so that it doesn't re-install pychromecast)

I'm out of my depth here (also pychromecast seems very complicated), so I'm not sure what the next-step is, I'm hoping that a developer of it responds and I can take action based on their feedback about a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests