@@ -279,7 +279,7 @@ def _get_library_model(self, manufacturer: str, model: str) -> LibraryModel:
279279 """Retrieve model info, or raise an error if not found."""
280280 model_info = self .model_infos .get (f"{ manufacturer } /{ model } " )
281281 if not model_info :
282- raise LibraryLoadingError ("Model not found in library: %s/%s" , manufacturer , model )
282+ raise LibraryLoadingError (f "Model not found in library: { manufacturer } / { model } " )
283283 return model_info
284284
285285 async def _needs_update (
@@ -424,10 +424,14 @@ def _save_file(data: bytes, directory: str) -> None:
424424 except (TimeoutError , aiohttp .ClientError ) as e :
425425 raise ProfileDownloadError (f"Failed to download profile: { manufacturer } /{ model } " ) from e
426426
427+ def _get_profile_hashes_path (self ) -> str :
428+ """Retrieve the local storage path for the profile hashes file."""
429+ return str (self .hass .config .path (STORAGE_DIR , BUILT_IN_LIBRARY_DIR , ".profile_hashes" ))
430+
427431 def _load_profile_hashes (self ) -> dict [str , str ]:
428432 """Load profile hashes from local storage"""
429433
430- path = self .hass . config . path ( STORAGE_DIR , BUILT_IN_LIBRARY_DIR , ".profile_hashes" )
434+ path = self ._get_profile_hashes_path ( )
431435 if not os .path .exists (path ):
432436 return {}
433437
@@ -437,6 +441,6 @@ def _load_profile_hashes(self) -> dict[str, str]:
437441 def _write_profile_hashes (self , hashes : dict [str , str ]) -> None :
438442 """Write profile hashes to local storage"""
439443
440- path = self .hass . config . path ( STORAGE_DIR , BUILT_IN_LIBRARY_DIR , ".profile_hashes" )
444+ path = self ._get_profile_hashes_path ( )
441445 with open (path , "w" ) as json_file :
442446 json .dump (hashes , json_file , indent = 4 )
0 commit comments