home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.91k stars 30.13k forks source link

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

Open konstantinozh opened 1 year ago

konstantinozh commented 1 year ago

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[bot] commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

ronnyek commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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[bot] commented 11 months ago

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 commented 11 months ago

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

PereViader commented 11 months ago

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 commented 10 months ago

I can confirm that.

HikariNoKitsune commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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.

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 commented 8 months ago

Is there a better workaround than simply disabling the integration?

Still the same issue with HA 2024.1.3

Neowonder commented 7 months ago

The issue unfortunately still persists in HA 2024.2.2.

Please, somebody solve this.

linkian19 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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:

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.

Neowonder commented 3 months ago

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

inarius commented 3 months ago

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.

linkian19 commented 1 month ago

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!

Dhatheway commented 1 month ago

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