youtube icon indicating copy to clipboard operation
youtube copied to clipboard

YouTube sensor rarely loads

Open BeardedTinker opened this issue 2 years ago • 9 comments

Version of the custom_component version 0.9.0

Describe the bug On one of my setups, when properly configuring sensors, they just don't load or get created. Exactly the same configuration on test system load nicely and works.

Out of 30 system restarts, it works once which is also strange that it would work at all.

Debugging is enabled for component, but not helping much and not additional errors or log entries are available.

Can further logging be added in component to try better pinpoint the issue?

Also, got same feedback from few other viewers that tried to add it to their system, with same problem that no sensor is ever created, even with proper sensor configuration.

log

2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.
2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.
2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.
2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.
2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.
2022-05-27 22:40:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform youtube is taking over 10 seconds.

And later, just this. All channel ID's are correct, tested by hand and also on second setup where it loads.

2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 
2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 
2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 
2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 
2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 
2022-05-27 22:40:52 DEBUG (MainThread) [custom_components.youtube.sensor] Unable to set up - 

BeardedTinker avatar May 28 '22 09:05 BeardedTinker

I am having the same issue.

allenrobberson avatar May 29 '22 07:05 allenrobberson

I have the same issue also

sevagjb avatar Jun 14 '22 22:06 sevagjb

You could try changing the timeout value on line 39 of the sensor.py file from 10 to 30.

async with async_timeout.timeout(30)

bergdahl avatar Jul 04 '22 21:07 bergdahl

async with async_timeout.timeout(30)

thanks Jonny, i will try it

sevagjb avatar Jul 04 '22 21:07 sevagjb

Can you please let me know if this is reliable. Also, do you know when the issue started? - I'm guessing that this is due to async_timeout no longer having the loop passed in (no longer permitted), if so, would have begun at 0.9.0 If this resolves the issue, I'll add it to the next release

pinkywafer avatar Jul 04 '22 23:07 pinkywafer

Not sure when it started - but I'm using @bergdahl fork for the moment to test and see if it works (with added debug info in it). So far so good. After each restart sensors did show up for YT channels.

BeardedTinker avatar Jul 05 '22 06:07 BeardedTinker

I also have this problem when launching Home Assistant. The sensor is not loading data. Typing async with async_timeout.timeout (30) for me solves this problem.

sp7dpt avatar Sep 25 '22 10:09 sp7dpt

The async_timeout.timeout(30) method did not work for me. I'm still not getting all attributes of channels and some channels never show (no matter how many times I restart)

PatrickHennecke avatar Oct 29 '23 21:10 PatrickHennecke

The async_timeout.timeout(30) method did not work for me. I'm still not getting all attributes of channels and some channels never show (no matter how many times I restart)

Same for me but on version 0.9.1

zeputt avatar Mar 05 '24 10:03 zeputt