mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-08-18 11:16:37 +00:00
Alexa Media Player ADDED - #421 - Added some test Notifications. (HA restart targetted notification)
This commit is contained in:
@@ -5,11 +5,14 @@ from custom_components.hacs.hacsbase.exceptions import (
|
||||
HacsException,
|
||||
HacsExpectedException,
|
||||
)
|
||||
from queueman import concurrent
|
||||
|
||||
|
||||
async def register_repository(full_name, category, check=True):
|
||||
# @concurrent(15, 5)
|
||||
async def register_repository(full_name, category, check=True, ref=None, action=False):
|
||||
"""Register a repository."""
|
||||
hacs = get_hacs()
|
||||
hacs.action = action
|
||||
from custom_components.hacs.repositories import (
|
||||
RERPOSITORY_CLASSES,
|
||||
) # To hanle import error
|
||||
@@ -24,26 +27,32 @@ async def register_repository(full_name, category, check=True):
|
||||
repository = RERPOSITORY_CLASSES[category](full_name)
|
||||
if check:
|
||||
try:
|
||||
await repository.registration()
|
||||
await repository.registration(ref)
|
||||
if hacs.system.status.new:
|
||||
repository.status.new = False
|
||||
if repository.validate.errors:
|
||||
hacs.common.skip.append(repository.data.full_name)
|
||||
if not hacs.system.status.startup:
|
||||
hacs.logger.error(f"Validation for {full_name} failed.")
|
||||
if hacs.action:
|
||||
raise HacsException(f"Validation for {full_name} failed.")
|
||||
return repository.validate.errors
|
||||
repository.logger.info("Registration complete")
|
||||
if hacs.action:
|
||||
repository.logger.info("Validation complete")
|
||||
else:
|
||||
repository.logger.info("Registration complete")
|
||||
except AIOGitHubException as exception:
|
||||
hacs.common.skip.append(repository.data.full_name)
|
||||
raise HacsException(f"Validation for {full_name} failed with {exception}.")
|
||||
|
||||
hacs.hass.bus.async_fire(
|
||||
"hacs/repository",
|
||||
{
|
||||
"id": 1337,
|
||||
"action": "registration",
|
||||
"repository": repository.data.full_name,
|
||||
"repository_id": repository.information.uid,
|
||||
},
|
||||
)
|
||||
if hacs.hass is not None:
|
||||
hacs.hass.bus.async_fire(
|
||||
"hacs/repository",
|
||||
{
|
||||
"id": 1337,
|
||||
"action": "registration",
|
||||
"repository": repository.data.full_name,
|
||||
"repository_id": repository.information.uid,
|
||||
},
|
||||
)
|
||||
hacs.repositories.append(repository)
|
||||
|
Reference in New Issue
Block a user