skorokithakis / catt

Cast All The Things allows you to send videos from many, many online sources to your Chromecast.
BSD 2-Clause "Simplified" License
3.34k stars 153 forks source link

Google cast stops after 30 seconds - Nest hub #353

Open hemandk opened 3 years ago

hemandk commented 3 years ago

Hi,

After the Nest Hub is updated to Fuchsia it stops if I cast home assistant after 30 seconds now instead of 10 minutes as before.

Would it be possible to Use disableIdleTimeout as mentioned in Google docs?

https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.CastReceiverOptions

window.castReceiverManager.start({statusText: "Application is starting", disableIdleTimeout: true});

this was also mentioned in the following issue that was closed: https://github.com/skorokithakis/catt/issues/335

bahuma20 commented 2 years ago

To be more concrete, this is the PR that fixed the timeout: https://github.com/home-assistant/frontend/pull/10531 They are "playing" an image so that it works

skorokithakis commented 2 years ago

Hmm, that looks doable, at first glance. @theychx, what do you think?

theychx commented 2 years ago

Current Dashcast code has to two ways of getting a cc to display arbitrary webpages. The first is to display the content inside an iframe. The second one, is to simply let the browser-instance running the cc-app (dashcast) render the page ("force"). Using the latter means that once the desired page has been rendered, the app/receiver code is no longer running. Right now, we use this option exclusively, as it will render any page (unlike the first option).

I guess we could bake our own version of dashcast, where the iframe-approach part of the code is enhanced with the technique mentioned by @jonaseymour @bahuma20, and then let catt users select this mode as an option to cast_site.

raulgbcr commented 2 years ago

You can "force" the reload in the internal browser and the media keeps playing for the OS, works with livestreams, not sure with images like they are doing on HA. The iframe approach works, but is very limited (cross site https is blocked)

dasb00ter commented 2 years ago

Hmmm how to describe... Last night at some point catt stopped recasting for me. My hub max retains the 10 minute time out requiring a recast from catt. In home assistant the hub showed as still playing and in my set up this stops recasting. I use a condition in an automation that if the hub is playing to not recast the dashboard. This stops the interruption of regular media on the hub. Home assistant now detects catt's casted dashboard as playing? This wrecked my automation as the condition showed always as playing. I now use a condition using the attribute app_name: to recast if its dashcast and that works. I mention it though because it seems to indicate a change in home assistant or google or dashcast

rocket59 commented 2 years ago

This is a different issue. Something changed a couple of months ago so at the end of the 10 minutes you need to actually send a command to stop the cast then start it again. Unfortunately this creates a bit of extra delay but at least it still works.

SamKirsch10 commented 2 years ago

I've gotten a custom receiver to the point where it shows my HA UI, and stays open as long as I want it to. Only problem is I can't touch any of my controls 👎 . Not sure how to get the Hub to interact with the iframe. Once I get that, happy to share

tungmeister commented 2 years ago

My solution is to use home assistants built in casting and cast a Lovelace view that contains the webpage I'm wanting to cast. This is working perfectly (I'm using tileboard) and says on All night (bedside control panel that gets triggered when someone is in bed)

J-o-h-n-M commented 2 years ago

@tungmeister I am doing the same at the moment. But what I notice is, that the built in casting is limited to the standard components. I cant get any of the custom components to work. I have tried everything I could find (changed and tried all the resource settings) , but nothing works. Seems to be a caching issue of the Google Hub.

With CATT everything works flawlessly, but with the current 30 second timeout I could not use it anymore. So I really hope CATT can be modified to avoid the timeout.

sirbooker commented 2 years ago

do you think this will ever run on a version 1 hub again for more than 30 seconds ? or have I missed something along the way.

skorokithakis commented 2 years ago

It sounds like it's definitely doable, someone just needs to do the work. Contributions are certainly appreciated on this one.

Ripper2909 commented 2 years ago

Also interested in this :)

mikejrh commented 2 years ago

@tungmeister Are you using Home Assistant cast for the built-in casting and Webpage card to cast your web site? Is there is no 30 second interruption with this configuration?

J-o-h-n-M commented 2 years ago

@tungmeister Are you using Home Assistant cast for the built-in casting and Webpage card to cast your web site? Is there is no 30 second interruption with this configuration?

If you use the home assistant cast, then there is indeed no timeout. It will stay all day. I just have it start early in the morning every day. The reason being that the Google Hub resets itself sometimes at night.

But the home assistant cast has limitation compared to CATT. I loved having the Tabs on the google hub. That is not possible with the home assistant cast. And custom components are hit or miss. Mostly they dont work.

mikejrh commented 2 years ago

@tungmeister Are you using Home Assistant cast for the built-in casting and Webpage card to cast your web site? Is there is no 30 second interruption with this configuration?

If you use the home assistant cast, then there is indeed no timeout. It will stay all day. I just have it start early in the morning every day. The reason being that the Google Hub resets itself sometimes at night.

But the home assistant cast has limitation compared to CATT. I loved having the Tabs on the google hub. That is not possible with the home assistant cast. And custom components are hit or miss. Mostly they dont work.

If the webpage card has an http site (not an https site) will the home assistant cast still work ?

J-o-h-n-M commented 2 years ago

If the webpage card has an http site (not an https site) will the home assistant cast still work ?

I think it needs to be https: https://www.home-assistant.io/integrations/cast

image

I use home assistant cloud so it worked without any issue

tungmeister commented 2 years ago

Yeah, it needs to be https - I also use the same method to cast a dashboard to one of my displays in the kitchen - I've not had any issues with custom elements, maybe I've just been lucky?

rocket59 commented 2 years ago

Any updates on this? Although I stopped using my Gen 1 hub I tried it today and the timeout appears to be about 1 min now (still not useful at all)

skorokithakis commented 2 years ago

Nope, none yet.

rocket59 commented 2 years ago

Bummer, but still hopeful it will get solved before the gen2 hubs are updated to Fuchsia otherwise we'll all be looking at other options like tablets.

skorokithakis commented 2 years ago

Indeed, but you know how it goes with open source, if you really want something, you usually have to do it yourself.

rocket59 commented 2 years ago

Understood. I'd help if I could but my knowledge is limited to pretty basic stuff unfortunately.

skorokithakis commented 2 years ago

Yep, perfectly understandable, I'm just saying that a lot of the open source progress is driven by people who want to scratch their own itch (and this isn't an itch I personally have right now, since I don't use the site cast functionality).

rocket59 commented 2 years ago

I discovered this morning that my Gen 1 hub seems to be casting longer than 30s now (in fact beyond the 10 min limit also) Can someone check that their gen 1 hub behaves the same way? In the past it's occasionally gone past 10 minutes for no particular reason for a short period then reverts back.

J-o-h-n-M commented 2 years ago

I discovered this morning that my Gen 1 hub seems to be casting longer than 30s now (in fact beyond the 10 min limit also) Can someone check that their gen 1 hub behaves the same way? In the past it's occasionally gone past 10 minutes for no particular reason for a short period then reverts back.

I dont use CATT anymore due to the time out issue, but wanted to try based on your post. But it seems my Gen 1 hub still has the 30second issue. So I cast with CATT and then within 30 seconds it is gone.

rocket59 commented 2 years ago

Bummer. I wasn't sure if google had pushed an update to fix this. Silly me for thinking they would. BTW what do you use in place of CATT?

J-o-h-n-M commented 2 years ago

I just use the normal Google Cast now (by using https://www.home-assistant.io/integrations/media_player/ ), I took a subscription to Nabu Casa and with that, its straight forward to do the casting. And the standard google cast stays on the hub as long as you want.

rocket59 commented 2 years ago

my Gen 1 hub still has the 30second issue

So weird. Mine was up for a full 6 days before reverting to the clock. I re-cast and so far it's been up for over a day.

J-o-h-n-M commented 2 years ago

my Gen 1 hub still has the 30second issue

So weird. Mine was up for a full 6 days before reverting to the clock. I re-cast and so far it's been up for over a day.

What version are you running (you can see it in the Home App

For me its Firmwareversion of system: 4.20210608.1.1146075 Firmwareversion of Cast: 1.56.291758

jonaseymour commented 2 years ago

Got some email notifications on this, so thought I'd try and see. It's currently been casting for over 30 minutes and hasn't timed out! One thing of note is that my graph cards aren't showing the lines (but some are), no not sure what that's about...

Firmware system: 6.20211109.1.3166232 Cast firmware: 1.60.302700

I've opted in to Preview programme updates, so maybe there's hope that one of those fixed this!!

J-o-h-n-M commented 2 years ago

I've opted in to Preview programme updates, so maybe there's hope that one of those fixed this!!

interesting, i also opted in now, will see. Your version are totally different. Lets hope they fixed it

J-o-h-n-M commented 2 years ago

Firmware system: 6.20211109.1.3166232 Cast firmware: 1.60.302700

Wonder how you got this. A 1.6... version is not even in preview yet : https://support.google.com/googlenest/answer/7365257#zippy=%2Ccurrent-preview-program-firmware-version

rocket59 commented 2 years ago

Firmware system: 6.20211109.1.3166232 Cast firmware: 1.60.302700

Mine is system f/w ..........1.3166212. cast f/w is the same

tinoue commented 2 years ago

The preview version of firmware (Firmware system: 6.20211109.1.3166232) solves the 30 secs issue. Thank you for your great info!!

2022年6月11日(土) 19:58 jonaseymour @.***>:

Got some email notifications on this, so thought I'd try and see. It's currently been casting for over 30 minutes and hasn't timed out! One thing of note is that my graph cards aren't showing the lines (but some are), no not sure what that's about...

Firmware system: 6.20211109.1.3166232 Cast firmware: 1.60.302700

I've opted in to Preview programme updates, so maybe there's hope that one of those fixed this!!

— Reply to this email directly, view it on GitHub https://github.com/skorokithakis/catt/issues/353#issuecomment-1152899054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMX452KA6V2M2N4QEBVBHLVORWO7ANCNFSM5BKCI4SA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

J-o-h-n-M commented 2 years ago

indeed, i now also have 6.20211109.1.3166232 and CATT works again!

rocket59 commented 2 years ago

Now if google would also update the V2 hubs and fix the 10 minute limit my happiness will be complete!

sirbooker commented 2 years ago

i can also confirm that catt is working again on ver 1 hubs this is awesome......... now is there a way to have it install catt on homaeassitant restart ? and can we use automations to start the casting and stop the casting ? i know the terminal has changed awhile back

J-o-h-n-M commented 2 years ago

i can also confirm that catt is working again on ver 1 hubs this is awesome......... now is there a way to have it install catt on homaeassitant restart ? and can we use automations to start the casting and stop the casting ? i know the terminal has changed awhile back

To have it install on restart, create a .sh file with this in it: pip3 install catt --upgrade i named it updatecatt.sh

Now add this to your configuration.yaml

shell_command:
  updatecatt: bash updatecatt.sh

Once you do this, you can use the service shell_command.updatecatt in an automation. Like this:

alias: Auto - Update CATT on startup
description: ''
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: shell_command.updatecatt
    data: {}
mode: single

Same concept to create a .sh file to automate the casting itself. My casting.sh contains this. It will only cast when nothing is playing. And also turn down the volume:

if ! catt -d "192.168.178.59" status | grep 'PLAYING'; then 
    catt -d "192.168.178.59" cast_site http://192.168.178.27:8123/lovelace-cast/0
    delay 10
    catt -d "192.168.178.59" volume 0
fi
lolouk44 commented 2 years ago

now is there a way to have it install catt on homaeassitant restart ?

- alias: HASS - Start Install Catt
  id: hass_start_install_catt
  initial_state: true
  trigger:
    - platform: homeassistant
      event: start
  action:
  - service: shell_command.catt_install

shell command: catt_install: pip3 install catt

[edit] @J-o-h-n-M shell command is much better

sirbooker commented 2 years ago

John Thank You Very Much.... 1 question 192.168.178.59 is that the ip of the google hub ?

if ! catt -d "192.168.178.59" status | grep 'PLAYING'; then catt -d "192.168.178.59" cast_site http://192.168.178.27:8123/lovelace-cast/0 delay 10 catt -d "192.168.178.59" volume 0 fi

jonaseymour commented 2 years ago

Yes, but you can also use the name of the hub instead of the IP. i.e. "Living room display".

sirbooker commented 2 years ago

home from work now i followed john's directions ... but catt does not get installed and I have tried several times as well as rebooting for changes in effect. i entered this at the command prompt in terminal pip3 install catt --upgrade
does not work says a folder is missing but if I enter this in terminal pip install catt==0.12.2 it works and I am able to cast to hub

but I am unable to get the shell command to work. any idea's...

thanks Paul.

J-o-h-n-M commented 2 years ago

but I am unable to get the shell command to work. any idea's...

You are not giving us much to go on. What did you try? Do you get any error message? What kind of installation do you have for HA? etc..

J-o-h-n-M commented 2 years ago

Yes, but you can also use the name of the hub instead of the IP. i.e. "Living room display".

this is indeed correct. The only reason I changed it to IP is that at some point the names changed and I had to reconfigure it. Not sure what made it change, but I felt that IP would be a more future proof solution for me.

dasb00ter commented 2 years ago

How are you guys running home assistant? Running HASSIO cant get a reinstall on restart going. My cast commands work fine but ive had to use something like this

"ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa hassio@redacted catt -d redacted cast_site http://10.0.0.249:8123/lovelace-tablet/environment"

Using google max here which is seems to be still on a 10 min timeout just for doc purposes

J-o-h-n-M commented 2 years ago

How are you guys running home assistant? Running HASSIO cant get a reinstall on restart going. My cast commands work fine but ive had to use something like this

Home Assistant has made it really confusing with all the different names for install. I dont think HASSIO is something being used anymore. I personally run this one: https://www.home-assistant.io/installation/generic-x86-64

Does the log say anything when you try to trigger the reinstall?

jonaseymour commented 2 years ago

How are you guys running home assistant? Running HASSIO cant get a reinstall on restart going. My cast commands work fine but ive had to use something like this

I run HASSOS, so have the 'ssh and web terminal' add on, then I just have an init command set in the configuration of the add on to install CATT when started.

python3 -m pip install catt==0.11.3

J-o-h-n-M commented 2 years ago

@dasb00ter I see that in 2019 I was using Hassio, this post will prob still work for you then : https://community.home-assistant.io/t/using-catt/130332/127

swiergot commented 2 years ago

For those using CATT to cast Home Assistant, I have come up with a fix for the 10 minutes timeout problem:

https://github.com/swiergot/ha-catt-fix

To fix it for all websites casted with CATT, changes to DashCast are required.

skorokithakis commented 2 years ago

Hmm, that's interesting @swiergot, how can we integrate it into CATT? Can we make our own receiver?