mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-08-20 20:16:52 +00:00
Alexa Media Player ADDED - #421 - Added some test Notifications. (HA restart targetted notification)
This commit is contained in:
@@ -6,7 +6,7 @@ https://hacs.xyz/
|
||||
"""
|
||||
|
||||
import voluptuous as vol
|
||||
from aiogithubapi import AIOGitHub
|
||||
from aiogithubapi import AIOGitHub, AIOGitHubException
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START
|
||||
from homeassistant.const import __version__ as HAVERSION
|
||||
@@ -21,6 +21,7 @@ from custom_components.hacs.configuration_schema import (
|
||||
)
|
||||
from custom_components.hacs.const import DOMAIN, ELEMENT_TYPES, STARTUP, VERSION
|
||||
from custom_components.hacs.constrains import check_constans, check_requirements
|
||||
from custom_components.hacs.helpers.remaining_github_calls import get_fetch_updates_for
|
||||
from custom_components.hacs.hacsbase.configuration import Configuration
|
||||
from custom_components.hacs.hacsbase.data import HacsData
|
||||
from custom_components.hacs.setup import (
|
||||
@@ -43,6 +44,8 @@ async def async_setup(hass, config):
|
||||
hacs = get_hacs()
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
if hacs.configuration and hacs.configuration.config_type == "flow":
|
||||
return True
|
||||
hass.data[DOMAIN] = config
|
||||
hacs.hass = hass
|
||||
hacs.session = async_create_clientsession(hass)
|
||||
@@ -78,7 +81,10 @@ async def async_setup_entry(hass, config_entry):
|
||||
hacs.configuration.config_type = "flow"
|
||||
hacs.configuration.config_entry = config_entry
|
||||
config_entry.add_update_listener(reload_hacs)
|
||||
startup_result = await hacs_startup()
|
||||
try:
|
||||
startup_result = await hacs_startup()
|
||||
except AIOGitHubException:
|
||||
startup_result = False
|
||||
if not startup_result:
|
||||
hacs.system.disabled = True
|
||||
raise ConfigEntryNotReady
|
||||
@@ -89,7 +95,10 @@ async def async_setup_entry(hass, config_entry):
|
||||
async def startup_wrapper_for_yaml():
|
||||
"""Startup wrapper for yaml config."""
|
||||
hacs = get_hacs()
|
||||
startup_result = await hacs_startup()
|
||||
try:
|
||||
startup_result = await hacs_startup()
|
||||
except AIOGitHubException:
|
||||
startup_result = False
|
||||
if not startup_result:
|
||||
hacs.system.disabled = True
|
||||
hacs.hass.components.frontend.async_remove_panel(
|
||||
@@ -113,6 +122,12 @@ async def hacs_startup():
|
||||
await hacs.hass.services.async_call(
|
||||
"logger", "set_level", {"hacs": "debug"}
|
||||
)
|
||||
await hacs.hass.services.async_call(
|
||||
"logger", "set_level", {"queueman": "debug"}
|
||||
)
|
||||
await hacs.hass.services.async_call(
|
||||
"logger", "set_level", {"AioGitHub": "debug"}
|
||||
)
|
||||
except ServiceNotFound:
|
||||
hacs.logger.error(
|
||||
"Could not set logging level to debug, logger is not enabled"
|
||||
@@ -132,6 +147,12 @@ async def hacs_startup():
|
||||
)
|
||||
hacs.data = HacsData()
|
||||
|
||||
can_update = await get_fetch_updates_for(hacs.github)
|
||||
if can_update == 0:
|
||||
hacs.logger.info("HACS is ratelimited, repository updates will resume in 1h.")
|
||||
else:
|
||||
hacs.logger.debug(f"Can update {can_update} repositories")
|
||||
|
||||
# Check HACS Constrains
|
||||
if not await hacs.hass.async_add_executor_job(check_constans):
|
||||
if hacs.configuration.config_type == "flow":
|
||||
|
Reference in New Issue
Block a user