5555from .const import DOMAIN
5656from .device_info import NestDeviceInfo , async_nest_devices_by_device_id
5757from .events import EVENT_NAME_MAP , MEDIA_SOURCE_EVENT_TITLE_MAP
58+ from .types import NestConfigEntry
5859
5960_LOGGER = logging .getLogger (__name__ )
6061
8081
8182
8283async def async_get_media_event_store (
83- hass : HomeAssistant , subscriber : GoogleNestSubscriber
84+ hass : HomeAssistant , config_entry : NestConfigEntry , subscriber : GoogleNestSubscriber
8485) -> EventMediaStore :
8586 """Create the disk backed EventMediaStore."""
8687 media_path = pathlib .Path (hass .config .cache_path (DOMAIN , MEDIA_CACHE_PATH ))
@@ -89,7 +90,7 @@ async def async_get_media_event_store(
8990 _prepare_media_cache_dir , media_path , legacy_media_path
9091 )
9192 store = Store [dict [str , Any ]](hass , STORAGE_VERSION , STORAGE_KEY , private = True )
92- return NestEventMediaStore (hass , subscriber , store , str (media_path ))
93+ return NestEventMediaStore (hass , config_entry , subscriber , store , str (media_path ))
9394
9495
9596def _prepare_media_cache_dir (
@@ -138,12 +139,14 @@ class NestEventMediaStore(EventMediaStore):
138139 def __init__ (
139140 self ,
140141 hass : HomeAssistant ,
142+ config_entry : NestConfigEntry ,
141143 subscriber : GoogleNestSubscriber ,
142144 store : Store [dict [str , Any ]],
143145 media_path : str ,
144146 ) -> None :
145147 """Initialize NestEventMediaStore."""
146148 self ._hass = hass
149+ self ._config_entry = config_entry
147150 self ._subscriber = subscriber
148151 self ._store = store
149152 self ._media_path = media_path
@@ -284,8 +287,8 @@ async def _get_devices(self) -> Mapping[str, str]:
284287 device_manager = await self ._subscriber .async_get_device_manager ()
285288 devices = {}
286289 for device in device_manager .devices .values ():
287- if device_entry := device_registry .async_get_device (
288- identifiers = { (DOMAIN , device .name )}
290+ if device_entry := device_registry .async_get_device_by_identifier (
291+ (DOMAIN , device .name ), self . _config_entry . entry_id
289292 ):
290293 devices [device .name ] = device_entry .id
291294 return devices
0 commit comments