diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index f8e9b5a6895..3ddfd4ffdbf 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -12,6 +12,7 @@ from aiogithubapi import AIOGitHubAPIException, GitHub, GitHubAPI from aiogithubapi.const import ACCEPT_HEADERS from awesomeversion import AwesomeVersion +from homeassistant.components.frontend import async_remove_panel from homeassistant.components.lovelace.system_health import system_health_info from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import Platform, __version__ as HAVERSION @@ -266,7 +267,7 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> try: if hass.data.get("frontend_panels", {}).get("hacs"): hacs.log.info("Removing sidepanel") - hass.components.frontend.async_remove_panel("hacs") + async_remove_panel(hass, "hacs") except AttributeError: pass diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 3b206c0df3c..17524145b60 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -24,6 +24,9 @@ from aiogithubapi.objects.repository import AIOGitHubAPIRepository from aiohttp.client import ClientSession, ClientTimeout from awesomeversion import AwesomeVersion +from homeassistant.components.persistent_notification import ( + async_create as async_create_persistent_notification, +) from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE, Platform from homeassistant.core import HomeAssistant, callback @@ -628,8 +631,8 @@ async def startup_tasks(self, _=None) -> None: for repo in critical: if not repo["acknowledged"]: self.log.critical("URGENT!: Check the HACS panel!") - self.hass.components.persistent_notification.create( - title="URGENT!", message="**Check the HACS panel!**" + async_create_persistent_notification( + self.hass, title="URGENT!", message="**Check the HACS panel!**" ) break diff --git a/custom_components/hacs/frontend.py b/custom_components/hacs/frontend.py index 6557517db9a..c1db4928961 100644 --- a/custom_components/hacs/frontend.py +++ b/custom_components/hacs/frontend.py @@ -4,6 +4,7 @@ import os from typing import TYPE_CHECKING +from homeassistant.components.frontend import async_register_built_in_panel from homeassistant.core import HomeAssistant, callback from .const import DOMAIN, URL_BASE @@ -65,7 +66,8 @@ def async_register_frontend(hass: HomeAssistant, hacs: HacsBase) -> None: # Add to sidepanel if needed if DOMAIN not in hass.data.get("frontend_panels", {}): - hass.components.frontend.async_register_built_in_panel( + async_register_built_in_panel( + hass, component_name="custom", sidebar_title=hacs.configuration.sidepanel_title, sidebar_icon=hacs.configuration.sidepanel_icon,