core icon indicating copy to clipboard operation
core copied to clipboard

Google Cast Integration doesn't detect paused state when cast from HA

Open chrisjenx opened this issue 2 years ago • 27 comments

The problem

HomeAssistant doesn't detect when something cast to a Google Nest Hub (gen 2) as paused when initiated from Home Assistant.

Replicate:

  • Cast dashboard to screen
  • Media State updates to playing (correct)
  • Swipe away dashboard, still "playing" (should be "paused")

Expected behavior:

  • Cast youtube/etc to device from phone/etc
  • Media state updates to playing (correct)
  • Swipe content away on screen, media state updates to "paused", (correct)

Not sure why but when casting from HA, it doesn't detect paused state (see screenshot) - is this intended behavior? I attached the affected script I'm using, but affects anything else that is relying on state not being "playing" when it's not.

image

What version of Home Assistant Core has the issue?

core-2022.4.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

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

trigger:
  - platform: state
    entity_id: media_player.nesthub51a4
    to: 'off'
    for: '00:00:20'
  - platform: state
    entity_id: media_player.nesthub51a4
    to: paused
    for: '00:00:20'
  - platform: time_pattern
    minutes: /9
  - platform: time_pattern
    minutes: '0'
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: media_player.nesthub51a4
                state: 'off'
              - condition: state
                entity_id: media_player.nesthub51a4
                state: paused
                for: '00:00:20'
        sequence:
          - service: media_player.volume_mute
            data:
              is_volume_muted: true
              entity_id: media_player.nesthub51a4
          - service: media_player.turn_off
            data:
              entity_id: media_player.nesthub51a4
          - delay:
              seconds: 2
          - service: media_player.turn_on
            data:
              entity_id: media_player.nesthub51a4
          - service: cast.show_lovelace_view
            data:
              view_path: dining-room
              dashboard_path: lovelace
              entity_id: media_player.nesthub51a4
          - service: cast.show_lovelace_view
            data:
              view_path: dining-room
              dashboard_path: lovelace
              entity_id: media_player.nesthub51a4
          - delay:
              seconds: 10
          - service: media_player.volume_mute
            data:
              is_volume_muted: false
              entity_id: media_player.nesthub51a4
id: '1650506777972'
alias: Cast Dashboard to Dining Room Nest
description: ''

Anything in the logs that might be useful for us?

ha.logs.log

Additional information

No response

chrisjenx avatar Apr 26 '22 23:04 chrisjenx

cast documentation cast source (message by IssueLinks)

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! (message by CodeOwnersMention)

Let me know if there's anything you want me to test/try

chrisjenx avatar Apr 28 '22 15:04 chrisjenx

Home Assistant relies on the chrome cast device signalling that it's been paused.

Please enable the logs below, then share a log file where the problem is reproduced.

logger:        
  default: info
  logs:
     homeassistant.components.cast: debug             
     homeassistant.components.cast.media_player: debug
     pychromecast: debug                              
     pychromecast.dial: debug                         
     pychromecast.discovery: info                     
     pychromecast.controllers.media: debug            
     pychromecast.socket_client: debug                
     homeassistant.components.zeroconf: debug         
     zeroconf: info                                   

emontnemery avatar May 05 '22 10:05 emontnemery

Added log to initial ticket, although can't see any media status for any of the cast devices, just CONNECTING/CONNECTED?

The device in question is media_player.nesthub51a4 I grabbed the logs after swiping off, "pausing", the HA Dashboard Cast to the Nest Hub.

I can try and grab another log when streaming from a different source? Or when actually dismissing the cast completely?

chrisjenx avatar May 05 '22 16:05 chrisjenx

Just to throw more weirdness into the mix. Here's me manually streaming my cameras to the device from home assistant. The stream while choppy does work and play. But as you can see home assistant thinks it's paused

CDC0A461-7D42-486E-8848-E78A63A32579 E35D1675-E146-4F86-A655-122338E16C04

chrisjenx avatar May 05 '22 16:05 chrisjenx

Here's YouTube from my phone. So home assistant is for sure getting state updates, very fast infact.

I'm wondering if the home assistant cast implementation is off? Trying to think of other experiments to do.

54A3BB18-AC3C-482E-9E52-DD2EA33EF299 F78B0671-4958-418B-8192-5B0155357E98 E126D361-53DB-4155-AFC5-E304BD70A7B5

chrisjenx avatar May 05 '22 16:05 chrisjenx

I have a Google Nest Hub v2 and can confirm that Home Assistant does not show the cast Lovelace/dashboard as paused when you swipe away.

DanDixon avatar Jun 04 '22 21:06 DanDixon

not sure if related but i see more differences between v1 and v2, streaming (rtsp) cameras via lovelace is only working on V1s and not V2s

bartbakels avatar Jun 25 '22 08:06 bartbakels

Bump, @emontnemery if you need a Nest to test I'm happy to send you one.

chrisjenx avatar Aug 09 '22 15:08 chrisjenx

Also from what I understand, this uses the Cloud service to cast to these devices, is there a way to test casting directly from HA?

chrisjenx avatar Aug 09 '22 15:08 chrisjenx

Just tested this with a Google Hub Max, same issue. Not sure what other info you guys need?

chrisjenx avatar Nov 29 '22 00:11 chrisjenx

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.

This is still very much an issue

chrisjenx avatar Feb 27 '23 02:02 chrisjenx

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.

This is still an issue

chrisjenx avatar May 28 '23 14:05 chrisjenx

Agreed that this is still an issue. If this worked it would be so much easier to make the dashboards more reliable.

DanDixon avatar Jun 15 '23 02:06 DanDixon

This has gotten better for me. I need to check if HA is getting state updates for me now.

chrisjenx avatar Jun 16 '23 17:06 chrisjenx

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.

This is still an issue on the latest version

harshithmohan avatar Sep 16 '23 06:09 harshithmohan

Confirming I'm still seeing this issue as well.

@emontnemery I added the log lines you suggested above and when I dismiss the UI on the screen, nothing shows up in the logs. Interestingly, even after the UI has been dismissed, the regular discovery log lines appear to show it still casting,

2023-11-11 09:29:54.210 DEBUG (MainThread) [homeassistant.components.zeroconf] Discovered new device google-nest-hub-<snip>._googlecast._tcp.local. ZeroconfServiceInfo(...<snip>... properties={'rs': 'Casting: Home: Thermostats', ...<snip>... })

Happy to provide more detailed log lines or anything else that might help debug.

wmoss avatar Nov 11 '23 17:11 wmoss

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.

Not fixed yet.

harshithmohan avatar Feb 09 '24 19:02 harshithmohan

~~Seems to be fixed as of 2024.3.1. Can anyone else confirm?~~ EDIT: Nope. I was just being stupid 🤦

harshithmohan avatar Mar 19 '24 13:03 harshithmohan