b0mbays / continuously_casting_dashboards

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

Dashboard not being cast after some time #13

Closed Thorvarium closed 1 year ago

Thorvarium commented 1 year ago

Me and a friend we are both using your extension (thx again for the work) and we are both having an issue that after a while one of our dashboards just stop casting.

I also noticed that once in a while it throws this error, not sure if it is related:

2023-04-27 11:12:21.684 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/streams.py", line 501, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/subprocess.py", line 195, in communicate
    stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/continuously_casting_dashboards/dashboard_caster.py", line 240, in start
    if (await self.check_both_states(device_name)) is None:
  File "/config/custom_components/continuously_casting_dashboards/dashboard_caster.py", line 173, in check_both_states
    status_output = await self.check_status(device_name, dashboard_state_name)
  File "/config/custom_components/continuously_casting_dashboards/dashboard_caster.py", line 115, in check_status
    stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=10)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
b0mbays commented 1 year ago

Hey @Thorvarium, this is caused by some missing exception handling for the TimeoutError. Thank you for posting!

I'm currently testing a new version that will be available in a couple of hours that should stop this error from happening 😄

I'll let you know when it's out!

b0mbays commented 1 year ago

The update is out now.

Please restart home assistant, then check inside HACS for the update 👍

Thanks!

Thorvarium commented 1 year ago

The update is out now.

Please restart home assistant, then check inside HACS for the update 👍

Thanks!

I updated it, thx! I'll let you know if the dashboard stop casting again

Thorvarium commented 1 year ago

I also noticed that sometimes the cast information dnt have the "dummy bla bla bla", maybe that is related to the bug image

b0mbays commented 1 year ago

Sounds good 👍 Not sure about the status from that screenshot.. Which chromecast devices are you using?

Thorvarium commented 1 year ago

I am using 3 nest hubs

On Fri, Apr 28, 2023, 4:53 AM b0mbays @.***> wrote:

Sounds good 👍 Not sure about the status from that screenshot.. Which chromecast devices are you using?

— Reply to this email directly, view it on GitHub https://github.com/b0mbays/continuously_casting_dashboards/issues/13#issuecomment-1527214891, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSANPOUWJI2BXHF6M2APULXDOARNANCNFSM6AAAAAAXOKF5HM . You are receiving this because you were mentioned.Message ID: @.***>

b0mbays commented 1 year ago

See how it functions after the update and report back. The integration should be stable now

iamer commented 1 year ago

The latest version (1.2.0) is broken for me, had to rollback to the previous version 1.1.4 There were no logs or errors, it just never started casting at all..

b0mbays commented 1 year ago

That's odd! Can you post your config here? (You can hide any IP addresses etc)

iamer commented 1 year ago

I think I found the issue: I have both start_time and end_time set to 00:00 and that worked with 1.1.4 to continuously cast The changes in 1.2.0 broke that, but it works if I set start_time 00:01 and end_time 00:00.

b0mbays commented 1 year ago

Sorry about that! I changed the condition for how the integration is checking the timings and that must be it. I'll add a note to the readme for other users 👍

If you change the logging level to "debug" in the configuration it should have reported that the timings you have set were 'outside' the allowed cast times for your devices.

Glad you found the fix! 😊

iamer commented 1 year ago

I suspected it was the issue by reading the diff of 1.2.0 to 1.1.4, and proved it by writing some test code. I had set the logging level to debug but couldn't find any messages in HA logs, maybe I was looking in the wrong place. Maybe it could be more user friendly to have an "always on" setting instead :)

Anyway thanks for your fantastic work!

b0mbays commented 1 year ago

That is strange you're not seeing any logs... If you set it to debug in the continuously_casting_dashboards config then you should see lots of logs in just the regular home assistant logs in settings. Or inside the homeassistant.log file 🤔 If you go via settings you have to click/tap the "Load full logs" to see them.

I like the idea of an "always on" feature! I'll add that in the next version 😁

Thanks!

Thorvarium commented 1 year ago

So far the dashboards have been casting fine, this look fixed. Thanks!