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

Recasting: AsyncioTimeoutError / HA dashboard is NOT streaming #82

Open baudneo opened 1 month ago

baudneo commented 1 month ago

I have 1 display, a lenovo smart display 8. It is on the same physical network as HASS and there are no firewall rules blocking it. mDNS is working properly, etc.

I have gone through all the issues and done all the troubleshooting and recommended fixes like restarting display/hass, increasing the cast_delay to 90 seconds. ha-catt-fix is installed, loaded in lovelace resources and working with the Dummy output:

[custom_components.continuously_casting_dashboards.dashboard_caster] Status output for Lenovo8 when checking for dashboard state 'Dummy': Title: Dummy 19:49:33 GMT-0600 (Mountain Daylight Time)

The logs show the error messages and timeouts infrequently. I have a ping running from hass to the display in the background to see if there are any connectivity issues, no pings are missed or delayed:

1618 packets transmitted, 1618 packets received, 0% packet loss
round-trip min/avg/max = 2.793/10.356/33.182 ms

My state_triggers are recognized and the logs say the state trigger dashboard is being cast, but it is 50/50 if it actually casts the doorbell dashboard.

state_trigger weird failure logs ``` 2024-10-20 17:53:19.561 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Entity 'binary_sensor.poe_doorbell_visitor' state changed to: on 2024-10-20 17:53:22.029 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Matched state for entity 'binary_sensor.poe_doorbell_visitor', casting dashboard to Lenovo8 2024-10-20 17:53:22.030 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Checking media status for Lenovo8 2024-10-20 17:53:24.440 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Media is not playing, waiting 5 seconds before re-checking... 2024-10-20 17:53:31.612 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Media is not playing on Lenovo8 2024-10-20 17:53:31.612 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 17:53:31.614 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Executing stop command... 2024-10-20 17:53:34.610 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Setting volume to 0... 2024-10-20 17:53:34.840 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Entity 'binary_sensor.poe_doorbell_visitor' state changed to: off 2024-10-20 17:53:36.610 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] All device map: {'Lenovo8': {'instances': [{'dashboard_url': 'http://10.0.1.20:8123/dashboard-lenovo8/default_view?kiosk', 'dashboard_state_name': 'Dummy', 'media_state_name': 'PLAYING', 'volume': 55, 'start_time': datetime.time(7, 0), 'end_time': datetime.time(1, 0), 'instance_change': False, 'speaker_groups': None}], 'current_instance': 0}} 2024-10-20 17:53:36.610 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Current local time: 17:53:36.610661 2024-10-20 17:53:36.610 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Local time is inside the allowed casting time for Lenovo8. Start time: 07:00:00 - End time: 01:00:00 2024-10-20 17:53:36.611 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Skipping normal flow as casting is triggered by state change 2024-10-20 17:53:40.355 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Executing the dashboard cast command... 2024-10-20 17:53:43.311 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Setting volume to 550... 2024-10-20 17:54:14.050 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Stopping casting dashboard on Lenovo8 after 30 seconds timeout 2024-10-20 17:54:21.611 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] All device map: {'Lenovo8': {'instances': [{'dashboard_url': 'http://10.0.1.20:8123/dashboard-lenovo8/default_view?kiosk', 'dashboard_state_name': 'Dummy', 'media_state_name': 'PLAYING', 'volume': 55, 'start_time': datetime.time(7, 0), 'end_time': datetime.time(1, 0), 'instance_change': False, 'speaker_groups': None}], 'current_instance': 0}} ```

Config

Config ```yaml logging_level: debug #Required: Set the logging level - debug/info/warning (default is 'warning' - try 'debug' for debugging) cast_delay: 90 #Required: Time (in seconds) for casting checks between each device. start_time: "07:00" #Optional: Global start time of the casting window (format: "HH:MM") - Default is set to "07:00" and can be individually overwritten per device below. end_time: "01:00" #Optional: Global end time of the casting window (format: "HH:MM") and must be after "00:00". Default is set to "01:00" and can be individually overwritten per device below. devices: "Lenovo8": #Required: Display name of your device. Find this on the actual device's settings or inside the Google Home app. - dashboard_url: "http://10.0.1.20:8123/dashboard-lenovo8/default_view?kiosk" #Required: Dashboard URL to be casted (This must be the local IP address of your HA instance, not homeassistant.local) volume: 55 #Optional: Volume to set the display. (If you remove this, the device will remain the same volume) start_time: "07:00" #Optional: Set the start time for this device end_time: "01:00" #Optional: Set the end time for this device state_triggers: "Lenovo8": - entity_id: binary_sensor.poe_doorbell_visitor to_state: "on" volume: 55 dashboard_url: "http://10.0.1.20:8123/dashboard-lenovo8/doorbell?kiosk" time_out: 30 #Optional! force_cast: true #Optional! ```

Log output

AsyncioTimeoutError ``` 2024-10-20 17:54:53.770 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 17:59:37.628 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:02:09.643 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:02:39.646 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:06:49.086 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:09:54.904 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:17:06.067 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:26:36.921 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:27:06.924 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:32:24.752 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:44:51.265 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:45:21.268 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:49:53.404 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:54:14.804 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 18:54:44.808 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:03:02.425 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:10:43.276 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:14:12.596 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:17:03.857 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:20:13.319 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:21:58.081 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:23:28.087 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:28:32.933 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:31:30.861 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:34:53.107 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:38:30.164 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:42:14.453 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:45:56.514 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:47:32.145 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:48:02.150 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:51:27.028 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:53:01.862 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:55:24.901 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 19:58:17.670 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 20:01:10.697 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 20:04:40.722 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: 2024-10-20 20:08:01.036 ERROR (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Asyncio TimeoutError checking Dummy state for Lenovo8: ```
HA dashboard is NOT streaming lines ``` 2024-10-20 17:54:53.770 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 17:56:12.608 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:02:39.647 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:17:06.067 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:27:06.925 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:32:24.752 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:45:21.269 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 18:54:44.808 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:03:02.426 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:07:03.870 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:10:43.276 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:23:28.087 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:31:30.861 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:36:35.098 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:38:30.164 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 19:48:02.150 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 20:01:10.698 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... 2024-10-20 20:04:40.722 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] HA Dashboard is NOT active on Lenovo8... ```
Recasting lines ``` 2024-10-20 17:53:22.029 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Matched state for entity 'binary_sensor.poe_doorbell_visitor', casting dashboard to Lenovo8 2024-10-20 17:53:31.612 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 17:54:59.499 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 17:56:22.014 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:02:59.926 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:18:02.816 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:27:36.929 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:32:54.756 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:46:11.850 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 18:55:46.441 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:03:59.835 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:05:24.736 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Matched state for entity 'binary_sensor.poe_doorbell_visitor', casting dashboard to Lenovo8 2024-10-20 19:05:30.564 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:07:13.208 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:11:37.067 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:23:58.091 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:32:00.865 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:36:44.592 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:39:29.645 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 19:48:58.599 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 20:01:40.702 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 2024-10-20 20:05:09.321 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Casting dashboard to Lenovo8 ```

Bonus Question

The auto level stuff doesnt work for me and when I dont have volume: set, it always set the volume to 1 after beginning the casting session, even if the logs say it is setting it to 5. What are the bounds of the volume? 0-10? 0-100? 0-255? I tried 55 and still the volume is set to 1 after casting starts.

Recasting similar in all tests of volume.

Recasting = display goes back to clock/ambient picture frame mode, dashcast splash screen, devices: > dashboard_url: dashboard starts. It takes a bit for the dashboard to populate all entities on recast.

baudneo commented 1 month ago

After much more debugging, I'm a bit more confused, but it seems like pychromecast has issues.

I think my dashboard is lagging because of the mushroom template badges and several other nested cards with card mod. I saw another user debugging lag issues when casting and they said that the theme and mushroom cards really made a noticeable difference in dashboard responsiveness.

When I use Hass to cast a panel dashboard with only 1 webrtc card, it works great, no timeouts and no recasting. Hass has an issue where if you try and recast a dashboard while a dashboard is already playing, you get the Invalid Namespace error until Hass is restarted. To work around the Hass issue, you MUST send media_player.stop to the device and then cast.

When I use Hass to stream the dashboard that ccd is set to cast, I get the same lag issues, but it errors out in different ways. It says it is casting and on the display it shows there is a cast, but clicking it does nothing, so the ambient screensaver or clock run. Requires a restart to work again.

The dashboard that is laggy is a sections dash with 2 sections and 3 cards. 2 cards are for lights, they use card-mod, expander card and mushroom light cards. The 3rd card is a webrtc card. I'm going to try more debugging tonight and remove the fancy stuff one by one to try and nail down the worst offender.

Just thought I should update my experience here. Might be good to add to the troubleshooting part as well.

So, all in all, both Hass and ccd have different issues casting dashboards.