b0mbays / continuously_casting_dashboards

HACS Integration for continuously casting a Home Assistant dashboard to your Google Chromecast Displays
MIT License
228 stars 11 forks source link

Dashboard loop #1

Closed nagels closed 1 year ago

nagels commented 1 year ago

Hi,

Was using your script prior this.

Added it to Hacs, restart, populated config and restart again. I can see that by Nest hub is loading the dashboard, then 5-10 sec after it goes back to the picture frame screen - And then the process is repeated after that. It seems to be stuck in a loop.

Not sure where the problem is on this one tho. HA Version: 2023.3.6 HA Dashboard: 1.0.4

Config looks like the image. 2023-03-24 23_10_44-File editor – Home Assistant - Opera

Please let me know if this is a problem or if I F'ed something up.

b0mbays commented 1 year ago

Hey @nagels, could you go inside the home assistant logs -> load full logs and post any relavent logs here?

Also, was this working fine with the script?

b0mbays commented 1 year ago

Without looking at the logs, i'm thinking that the cast_delay might be the issue. If you increase this to 60 can you see if you still have the same problem?

With your setup only being 1 dashboard, the script will keep checking every 30 seconds for that device if anything is playing/casting on the device. This timer starts as soon as the 'casting process' begins. So, if your devices takes longer than 30 seconds to get the dashboard up and running for the display to return a "playing" state, then this integration will try to cast it again. Forcing you into this loop.

I tested how long it takes for my Google Nest Hub to be in this "playing" state and it seems to be around 20 seconds. So, if your display takes longer than this which could be for many different reasons (older firmware, different device, network issues etc) then you may need to keep this delay at 60 seconds or higher.

Capture

nagels commented 1 year ago

The script worked fine for 24 hours - Then it got a bit weird around 6:30 - but that might have been a user error as I changed the time and cant remember if I reconfigured the script.

I set the delay to 60 sec and kept log level at info. The below is what is see - I can only show the one as the rest of the log is filled with warnings from Xiaomi Map being to large :D But it will say that HA Dashboard (or media) is NOT playing on xxxxxx - Every 60 sec.

image

Looking at the log for the device it seems a bit odd tho. image

I might try with 90 sec - Just to see if that resolves anything. I should mention that the Dashboard loads on the Nest - And the state seems to be switching correct within HA.

nagels commented 1 year ago

So 90 sec seems to work :O image

This have been in the log 3 times so far and the dashboard is not reloading every 30 sec on the Nest!

It might be worth changing the default delay to 90 to accommodate for slow connection etc.

b0mbays commented 1 year ago

That is strange. Your latest comment shows the logs executing the "sleeping time" steps... As it seems to be past 2.00am local time. It should be stopping the dashboards from casting on your devices at this time, but it looks like it can't actually find any active cast sessions.

Perhaps the "state" of the display is different on your device when the dashboard is "active". Which generation of the nest hub are you using? I'm also wandering if there's a language issue here if you are GMT+1 :D

Lets try some testing to find out.. Could you either SSH into HA and execute these commands or use the same system you were previously running the script on? It should have 'catt' installed. If it's not installed:

pip install catt or pip3 install catt

Play some media on the display such as spotify/youtube and then do a:

catt -d "Stuen Display" status

Try and cast the dashboard to the device using the script/this integration/some other method and when it is on the display do the same:

catt -d "Stuen Display" status

Then do a "Hey Google, stop" and do the same:

catt -d "Stuen Display" status

And post back the results of these commands and we'll go from there!

nagels commented 1 year ago

I am running a Net Hub 2'nd gen with software version: 47.9.447810048 and Chromecast firmware: 1.56.324896. The langue on the display is Danish But it is only used for Dashboard Casting - So we do not use the "Hey Google". I can try and reset the Hub and install it with English - That should be no problem.

A little side note: The integration is still active in HACS - It started to Cast the dashboard while I was watching a YouTube for the test below - But this could have been a timing problem as it did not interfere the second time around.

I also though about removing the Google integration, resetting the Hub, removing Dashboard Casting - And then start from a "fresh" with these things - It could be that the Hub is confused somehow after I switched over from the script.

Output of the commands:

Play some media on the display such as spotify/youtube and then do a: image

Casted via the "Browse Media" under the device in HA. image

Hey Google Stop: image

b0mbays commented 1 year ago

Okay I can see the issue. The current implementation checks for a status of "Dummy" for when the dashboard is casting. Yours is reporting "Home" so it never thinks the dashboard is active. I can make this configurable via the configuration.yaml file.

Give me a couple of hours and I'll push a new version 😊

nagels commented 1 year ago

Sound amazing!

A little extra thing to add. If I remove the config for Casting Dashboard and run this in HA Manually: catt -d "Stuen Display" cast_site http://192.168.1.140:8123/frede-mobil/default_view And then run: catt -d "Stuen Display" status - it returns Volume:50

I am not sure if this is the right thing for it at to return? As volume 50 is the same as when not casting to it...

b0mbays commented 1 year ago

Hey @nagels , can you restart Home Assistant and install the new update? (1.0.5) and update your configuration.yaml file to the new format explained here.

You should just change yours to "Home" for the dashboard_state_name.

b0mbays commented 1 year ago

I may have misread your first reply above. I thought the "Casted via the "Browse Media" under the device in HA." was you casting the dashboard.. is this the case?

nagels commented 1 year ago

Under Google Cast - Choose the device and press "Browse Media", Then choose the dashboard as shown below. image image

As also mentioned in the earlier reply - When casting with catt -d "Stuen Display" cast_site http://192.168.1.140:8123/frede-mobil/default_view and checking status it just return "Volume: 50" So for me right now it looks like the state is actually not returned by Google Cast for some reason.

Update 1.0.5 with updated config is the same problem - It jumps in and out of the dashboard on the Nest Hub. image

b0mbays commented 1 year ago

Do you have ha-catt-fix installed? https://github.com/swiergot/ha-catt-fix

After digging around trying to figure out why all of my dashboard report the state of "Dummy" - it comes from this!

If you do have it installed, open your dashboard -> three dots in the corner -> edit dashboard -> three dots -> manage resources.

You should find the ha-catt-fix in the list as shown below:

ha-catt

b0mbays commented 1 year ago

Here is where the title is coming from in the ha-catt-fix module:

Capture2323

So this should fix your issues 😄

b0mbays commented 1 year ago

It's not explained in the readme but follow the usual installation for HACS:

HACS -> Integrations -> Three dots -> Custom Repositories

Repository: swiergot/ha-catt-fix

Category: Lovelace

Then follow the rest of the instructions in the README 👍

nagels commented 1 year ago

OMG!

I don't event want to start on how stupid I feel right now:

So I did all the setup, but then I butchered the Trusted networks - Locking everyone else except or the Dashboard out :D So I reverted to a backup and when looking at the custom repo list in HACS catt-fix was there - I just did not install it again..

I am so sorry for wasting your time on this - Installing catt-fix again, restarting HA worked like a charm.

b0mbays commented 1 year ago

Ha, no problem! Is everything working as expected now?

I have now created a new feature that we don't really need 😆 I'm going to change the docs to make this a 'hidden feature' that may be useful in the future if Google changes the way it casts things.

It's partly my fault for not realising sooner, or even looking into why my dashboard was reporting "Dummy" in the first place!

nagels commented 1 year ago

Well, the dashboard have been on the screen now for 7 min with Dummy. image

So I would say it works yes :O It is always good with some practice I guess :D

Not your fault - This is on me not paying enough attention - can't see the trees for the forest: Thanks for your time, assistance in troubleshooting and for pushing a "fix" so fast :D

b0mbays commented 1 year ago

Great to hear! I learned something here so all is not lost 👍

Closing this issue now, please reach out again if you have any issues/suggestions.

doenau commented 1 year ago

+1 for also needing to set the cast_delay to 90 seconds. I had the same issues when testing at 45 seconds, then at 60 seconds