Add in Alexa Last used Sensor. #768

This commit is contained in:
ccostan
2020-06-07 14:29:26 -04:00
parent f9094e57d4
commit 93c5bb6837
34 changed files with 441 additions and 233 deletions

View File

@@ -1,6 +1,7 @@
"""Return repository information if any."""
import json
from aiogithubapi import AIOGitHubAPIException, GitHub
from custom_components.hacs.globals import get_hacs
from custom_components.hacs.handler.template import render_template
from custom_components.hacs.hacsbase.exceptions import HacsException
@@ -63,6 +64,28 @@ async def get_releases(repository, prerelease=False, returnlimit=5):
raise HacsException(exception)
def get_frontend_version():
"""get the frontend version from the manifest."""
manifest = read_hacs_manifest()
frontend = 0
for requirement in manifest.get("requirements", []):
if requirement.startswith("hacs_frontend"):
frontend = requirement.split("==")[1]
break
return frontend
def read_hacs_manifest():
"""Reads the HACS manifest file and returns the contents."""
hacs = get_hacs()
content = {}
with open(
f"{hacs.system.config_path}/custom_components/hacs/manifest.json"
) as manifest:
content = json.loads(manifest.read())
return content
async def get_integration_manifest(repository):
"""Return the integration manifest."""
if repository.data.content_in_root: