core icon indicating copy to clipboard operation
core copied to clipboard

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

Open konstantinozh opened this issue 2 years ago • 27 comments

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

konstantinozh avatar Feb 04 '23 11:02 konstantinozh

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)

home-assistant[bot] avatar Feb 04 '23 11:02 home-assistant[bot]

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

PereViader avatar Feb 09 '23 11:02 PereViader

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

konstantinozh avatar Mar 01 '23 11:03 konstantinozh

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

ronnyek avatar May 09 '23 04:05 ronnyek

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.

PereViader avatar May 09 '23 12:05 PereViader

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 ?

dzegarra avatar Jun 05 '23 19:06 dzegarra

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.

xenoputtss avatar Jul 24 '23 16:07 xenoputtss

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.

bmac6996 avatar Aug 07 '23 19:08 bmac6996

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.

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

dzegarra avatar Nov 06 '23 07:11 dzegarra

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

PereViader avatar Nov 06 '23 07:11 PereViader

I can confirm that.

egandro avatar Nov 24 '23 12:11 egandro

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...

HikariNoKitsune avatar Dec 11 '23 01:12 HikariNoKitsune

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.

JanderII avatar Dec 15 '23 10:12 JanderII

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.

geoffoxholm avatar Dec 24 '23 15:12 geoffoxholm

Is there a better workaround than simply disabling the integration?

Still the same issue with HA 2024.1.3

aryasenna avatar Jan 13 '24 12:01 aryasenna

The issue unfortunately still persists in HA 2024.2.2.

Please, somebody solve this.

Neowonder avatar Feb 21 '24 15:02 Neowonder

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.

linkian19 avatar Mar 15 '24 17:03 linkian19

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 avatar Mar 24 '24 15:03 geoffoxholm

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.

geoffoxholm avatar Mar 24 '24 15:03 geoffoxholm

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!

Neowonder avatar Mar 26 '24 17:03 Neowonder

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.

geoffoxholm avatar Mar 26 '24 20:03 geoffoxholm

Does anyone have any news about an official fix, please?

Neowonder avatar Jun 21 '24 15:06 Neowonder

confirmed this is also happening in my environment. was brought here from this forum link. https://www.reddit.com/r/audible/s/vKhgl7ze6R

Confirmed that the casting worked again after disabling the HASS devices.

inarius avatar Jul 03 '24 04:07 inarius

Bumping this thread again as this is still an issue with Audible and having the Cast integration enabled. Disabling either the integration entirely or just a device will allow Audible to cast to those devices properly. Having it enabled in Home Assistant breaks casting from Audible.

I've also made a similar comment in the pychromecast issue here: https://github.com/home-assistant-libs/pychromecast/issues/738#issuecomment-2282189352

Please let us know if there is anything we can assist with in getting this resolved. Thank you!

linkian19 avatar Aug 10 '24 19:08 linkian19

Same issue here after setting up the cast devices in HA I am unable to cast Audible (so far only it) to any device. I have disabled the cast device in HA and the issue still persists.

Core - 2024.8.3 Supervisor - 2024.08.0 Operating System - 13.1 Frontend - 20240809.0

Dhatheway avatar Aug 29 '24 19:08 Dhatheway

The issue sadly still persists in HA:

Core - 2024.10.2 Supervisor - 2024.10.2 Operating System - 13.1 Frontend - 20241002.3

Neowonder avatar Oct 15 '24 08:10 Neowonder

Good news! Audible's quirk handling has just been implemented on the upstream library.

https://github.com/home-assistant-libs/pychromecast/commit/fdf77661d949bd8118104ef01e05611f1047661a

Audible and HA Google Cast hopefully should work together on the next HA 2024.11 release if the relevant PR got merged in time.

I'm running the patched library locally, and Audible casting works just fine.

So yeah, finally there is some other way, other than just simply disabling the integration.

All thanks to @geoffoxholm for initiating the PR and @emontnemery for reviewing+merging.

aryasenna avatar Oct 27 '24 08:10 aryasenna

Core - 2024.11.1 Supervisor - 2024.11.2 Operating System - 13.2 Frontend - 20241106.2

In my testing it seem like this was fixed but it highlights another potential issue under Music Assistant. Previously the work around to allow Audible to cast was:

  • Disable the devices you wanted to cast to under "Google Cast" of Home Assistant
  • Disable "Chromecast" as a player provider under "Music Assistant" of Home Assistant

Based on my testing this morning after updating Home Assistant (and no coffee yet) I am able to leave all the devices enabled within "Google Cast" and everything works great, but as soon as I enable the Chromecast option under Music Assistant the behavior appears again. When I disable the Chromecast option under Music Assistant everything goes back to working correctly.

Dhatheway avatar Nov 09 '24 13:11 Dhatheway

It's possible that music assistant is using pychromecast too, and the dev there needs to update their dependency.

geoffoxholm avatar Nov 09 '24 17:11 geoffoxholm