Update HACS

This commit is contained in:
root
2022-05-23 17:48:47 -07:00
parent 3bdb8638a8
commit 1d83dd0c31
163 changed files with 862 additions and 11844 deletions

View File

@@ -4,6 +4,7 @@ from __future__ import annotations
import json
from typing import TYPE_CHECKING
from ..enums import HacsCategory, HacsDispatchEvent
from ..exceptions import HacsException
from ..utils.decorator import concurrent
from .base import HacsRepository
@@ -21,7 +22,7 @@ class HacsPluginRepository(HacsRepository):
self.data.full_name = full_name
self.data.full_name_lower = full_name.lower()
self.data.file_name = None
self.data.category = "plugin"
self.data.category = HacsCategory.PLUGIN
self.content.path.local = self.localpath
@property
@@ -71,8 +72,8 @@ class HacsPluginRepository(HacsRepository):
# Signal entities to refresh
if self.data.installed:
self.hacs.hass.bus.async_fire(
"hacs/repository",
self.hacs.async_dispatch(
HacsDispatchEvent.REPOSITORY,
{
"id": 1337,
"action": "update",
@@ -94,11 +95,13 @@ class HacsPluginRepository(HacsRepository):
def update_filenames(self) -> None:
"""Get the filename to target."""
possible_locations = ("",) if self.data.content_in_root else ("release", "dist", "")
possible_locations = (
("",) if self.repository_manifest.content_in_root else ("release", "dist", "")
)
# Handler for plug requirement 3
if self.data.filename:
valid_filenames = (self.data.filename,)
if self.repository_manifest.filename:
valid_filenames = (self.repository_manifest.filename,)
else:
valid_filenames = (
f"{self.data.name.replace('lovelace-', '')}.js",