File tree Expand file tree Collapse file tree 4 files changed +12
-16
lines changed
homeassistant/components/youtube Expand file tree Collapse file tree 4 files changed +12
-16
lines changed Original file line number Diff line number Diff line change 31
31
def get_upload_playlist_id (channel_id : str ) -> str :
32
32
"""Return the playlist id with the uploads of the channel.
33
33
34
- Replacing the UC in the channel id (UCxxxxxxxxxxxx) with UU is the way to do it without extra request (UUxxxxxxxxxxxx).
34
+ Replacing the UC in the channel id (UCxxxxxxxxxxxx) with UU is
35
+ the way to do it without extra request (UUxxxxxxxxxxxx).
35
36
"""
36
37
return channel_id .replace ("UC" , "UU" , 1 )
37
38
Original file line number Diff line number Diff line change 5
5
6
6
from homeassistant .const import ATTR_ID
7
7
from homeassistant .helpers .device_registry import DeviceEntryType
8
- from homeassistant .helpers .entity import DeviceInfo , Entity , EntityDescription
8
+ from homeassistant .helpers .entity import DeviceInfo , EntityDescription
9
+ from homeassistant .helpers .update_coordinator import CoordinatorEntity
9
10
10
11
from .const import ATTR_TITLE , DOMAIN , MANUFACTURER
11
12
from .coordinator import YouTubeDataUpdateCoordinator
12
13
13
14
14
- class YouTubeChannelEntity (Entity ):
15
+ class YouTubeChannelEntity (CoordinatorEntity ):
15
16
"""An HA implementation for YouTube entity."""
16
17
17
18
_attr_has_entity_name = True
@@ -23,6 +24,7 @@ def __init__(
23
24
channel : dict [str , Any ],
24
25
) -> None :
25
26
"""Initialize a Google Mail entity."""
27
+ super ().__init__ (coordinator )
26
28
self .entity_description = description
27
29
self ._attr_unique_id = (
28
30
f"{ coordinator .config_entry .entry_id } _{ channel [ATTR_ID ]} _{ description .key } "
Original file line number Diff line number Diff line change 19
19
}
20
20
}
21
21
},
22
- "options" : {
23
- "step" : {
24
- "init" : {
25
- "description" : " Select the channels you want to add." ,
26
- "data" : {
27
- "channels" : " YouTube channels"
28
- }
29
- }
30
- }
31
- },
32
22
"entity" : {
33
23
"sensor" : {
34
24
"latest_upload" : {
Original file line number Diff line number Diff line change 1
1
"""Sensor tests for the YouTube integration."""
2
+ from datetime import timedelta
2
3
from unittest .mock import patch
3
4
4
5
from google .auth .exceptions import RefreshError
5
6
6
7
from homeassistant import config_entries
7
- from homeassistant .components .youtube import COORDINATOR , DOMAIN
8
+ from homeassistant .components .youtube import DOMAIN
8
9
from homeassistant .core import HomeAssistant
10
+ from homeassistant .util import dt
9
11
12
+ from ...common import async_fire_time_changed
10
13
from .conftest import TOKEN , ComponentSetup
11
14
12
15
@@ -40,8 +43,8 @@ async def test_sensor_reauth_trigger(
40
43
await setup_integration ()
41
44
42
45
with patch (TOKEN , side_effect = RefreshError ):
43
- entry = hass . config_entries . async_entries ( DOMAIN )[ 0 ]
44
- await hass . data [ DOMAIN ][ entry . entry_id ][ COORDINATOR ]. async_refresh ( )
46
+ future = dt . utcnow () + timedelta ( minutes = 15 )
47
+ async_fire_time_changed ( hass , future )
45
48
await hass .async_block_till_done ()
46
49
47
50
flows = hass .config_entries .flow .async_progress ()
You can’t perform that action at this time.
0 commit comments