『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 5770|回复: 6

求助各位大神,HACS装不了

[复制链接]

3

主题

37

帖子

113

积分

注册会员

Rank: 2

积分
113
金钱
76
HASS币
0
发表于 2020-3-2 20:01:30 | 显示全部楼层 |阅读模式
我用的是armbian+docker
错误日志:
2020-03-02 19:17:56 ERROR (MainThread) [homeassistant.components.hassio] Component error: hacs - No module named 'aiogithubapi'

#configuration.yaml配置
hacs:
  token: c85dc07ace58f562fa8ad83807036fbffe123123 
  appdaemon: true
python_script: 
frontend:
  themes: !include_dir_merge_named themes

#hacs的__init__.py
"""
Custom element manager for community created elements.

For more details about this integration, please refer to the documentation at
https://hacs.xyz/
"""

import voluptuous as vol
from aiogithubapi import AIOGitHub
from homeassistant import config_entries
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.const import __version__ as HAVERSION
from homeassistant.components.lovelace import system_health_info
from homeassistant.exceptions import ConfigEntryNotReady, ServiceNotFound
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.event import async_call_later

from custom_components.hacs.configuration_schema import (
    hacs_base_config_schema,
    hacs_config_option_schema,
)
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.hacsbase.configuration import Configuration
from custom_components.hacs.hacsbase.data import HacsData
from custom_components.hacs.setup import (
    add_sensor,
    load_hacs_repository,
    setup_frontend,
)

from custom_components.hacs.globals import get_hacs

# from custom_components.hacs.helpers.network import internet_connectivity_check

SCHEMA = hacs_base_config_schema()
SCHEMA[vol.Optional("options")] = hacs_config_option_schema()
CONFIG_SCHEMA = vol.Schema({DOMAIN: SCHEMA}, extra=vol.ALLOW_EXTRA)


async def async_setup(hass, config):
    """Set up this integration using yaml."""
    hacs = get_hacs()
    if DOMAIN not in config:
        return True
    hass.data[DOMAIN] = config
    hacs.hass = hass
    hacs.session = async_create_clientsession(hass)
    hacs.configuration = Configuration.from_dict(
        config[DOMAIN], config[DOMAIN].get("options")
    )
    hacs.configuration.config = config
    hacs.configuration.config_type = "yaml"
    await startup_wrapper_for_yaml()
    hass.async_create_task(
        hass.config_entries.flow.async_init(
            DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data={}
        )
    )
    return True


async def async_setup_entry(hass, config_entry):
    """Set up this integration using UI."""
    hacs = get_hacs()
    conf = hass.data.get(DOMAIN)
    if config_entry.source == config_entries.SOURCE_IMPORT:
        if conf is None:
            hass.async_create_task(
                hass.config_entries.async_remove(config_entry.entry_id)
            )
        return False
    hacs.hass = hass
    hacs.session = async_create_clientsession(hass)
    hacs.configuration = Configuration.from_dict(
        config_entry.data, config_entry.options
    )
    hacs.configuration.config_type = "flow"
    hacs.configuration.config_entry = config_entry
    config_entry.add_update_listener(reload_hacs)
    startup_result = await hacs_startup()
    if not startup_result:
        hacs.system.disabled = True
        raise ConfigEntryNotReady
    hacs.system.disabled = False
    return startup_result


async def startup_wrapper_for_yaml():
    """Startup wrapper for yaml config."""
    hacs = get_hacs()
    startup_result = await hacs_startup()
    if not startup_result:
        hacs.system.disabled = True
        hacs.hass.components.frontend.async_remove_panel(
            hacs.configuration.sidepanel_title.lower()
            .replace(" ", "_")
            .replace("-", "_")
        )
        hacs.logger.info("Could not setup HACS, trying again in 15 min")
        async_call_later(hacs.hass, 900, startup_wrapper_for_yaml())
        return
    hacs.system.disabled = False


async def hacs_startup():
    """HACS startup tasks."""
    hacs = get_hacs()
    if not check_requirements():
        return False
    if hacs.configuration.debug:
        try:
            await hacs.hass.services.async_call(
                "logger", "set_level", {"hacs": "debug"}
            )
        except ServiceNotFound:
            hacs.logger.error(
                "Could not set logging level to debug, logger is not enabled"
            )

    lovelace_info = await system_health_info(hacs.hass)
    hacs.logger.debug(f"Configuration type: {hacs.configuration.config_type}")
    hacs.version = VERSION
    hacs.logger.info(STARTUP)
    hacs.system.config_path = hacs.hass.config.path()
    hacs.system.ha_version = HAVERSION

    hacs.system.lovelace_mode = lovelace_info.get("mode", "yaml")
    hacs.system.disabled = False
    hacs.github = AIOGitHub(
        hacs.configuration.token, async_create_clientsession(hacs.hass)
    )
    hacs.data = HacsData()

    # Check HACS Constrains
    if not await hacs.hass.async_add_executor_job(check_constans):
        if hacs.configuration.config_type == "flow":
            if hacs.configuration.config_entry is not None:
                await async_remove_entry(hacs.hass, hacs.configuration.config_entry)
        return False

    # Set up frontend
    await setup_frontend()

    #    if not await hacs.hass.async_add_executor_job(internet_connectivity_check):
    #        hacs.logger.critical("No network connectivity")
    #        return False

    # Load HACS
    if not await load_hacs_repository():
        if hacs.configuration.config_type == "flow":
            if hacs.configuration.config_entry is not None:
                await async_remove_entry(hacs.hass, hacs.configuration.config_entry)
        return False

    # Restore from storefiles
    if not await hacs.data.restore():
        hacs_repo = hacs.get_by_name("hacs/integration")
        hacs_repo.pending_restart = True
        if hacs.configuration.config_type == "flow":
            if hacs.configuration.config_entry is not None:
                await async_remove_entry(hacs.hass, hacs.configuration.config_entry)
        return False

    # Add aditional categories
    hacs.common.categories = ELEMENT_TYPES
    if hacs.configuration.appdaemon:
        hacs.common.categories.append("appdaemon")
    if hacs.configuration.python_script:
        hacs.configuration.python_script = False
        if hacs.configuration.config_type == "yaml":
            hacs.logger.warning(
                "Configuration option 'python_script' is deprecated and you should remove it from your configuration, HACS will know if you use 'python_script' in your Home Assistant configuration, this option will be removed in a future release."
            )
    if hacs.configuration.theme:
        hacs.configuration.theme = False
        if hacs.configuration.config_type == "yaml":
            hacs.logger.warning(
                "Configuration option 'theme' is deprecated and you should remove it from your configuration, HACS will know if you use 'theme' in your Home Assistant configuration, this option will be removed in a future release."
            )

    # Setup startup tasks
    if hacs.configuration.config_type == "yaml":
        hacs.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, hacs.startup_tasks())
    else:
        async_call_later(hacs.hass, 5, hacs.startup_tasks())

    # Show the configuration
    hacs.configuration.print()

    # Set up sensor
    await hacs.hass.async_add_executor_job(add_sensor)

    # Mischief managed!
    return True


async def async_remove_entry(hass, config_entry):
    """Handle removal of an entry."""
    hacs = get_hacs()
    hacs.logger.info("Disabling HACS")
    hacs.logger.info("Removing recuring tasks")
    for task in hacs.recuring_tasks:
        task()
    hacs.logger.info("Removing sensor")
    try:
        await hass.config_entries.async_forward_entry_unload(config_entry, "sensor")
    except ValueError:
        pass
    hacs.logger.info("Removing sidepanel")
    try:
        hass.components.frontend.async_remove_panel("hacs")
    except AttributeError:
        pass
    hacs.system.disabled = True
    hacs.logger.info("HACS is now disabled")


async def reload_hacs(hass, config_entry):
    """Reload HACS."""
    await async_remove_entry(hass, config_entry)
    await async_setup_entry(hass, config_entry)


回复

使用道具 举报

21

主题

273

帖子

3446

积分

论坛元老

Rank: 8Rank: 8

积分
3446
金钱
3168
HASS币
30
发表于 2020-3-2 20:30:29 | 显示全部楼层
本帖最后由 MX10085 于 2020-3-2 20:32 编辑

下载hacs包放在custom_components里面

https://github.com/hacs/integration
然后用配置里面的集成HACS
回复

使用道具 举报

3

主题

37

帖子

113

积分

注册会员

Rank: 2

积分
113
金钱
76
HASS币
0
 楼主| 发表于 2020-3-2 22:02:24 | 显示全部楼层
MX10085 发表于 2020-3-2 20:30
下载hacs包放在custom_components里面

https://github.com/hacs/integration

检查配置的时候出错,重启不了,提示没有aiogithubapi这个模块,不知道是不是配置文件没有定义还是怎么的
回复

使用道具 举报

1

主题

220

帖子

865

积分

高级会员

Rank: 4

积分
865
金钱
645
HASS币
0
发表于 2020-3-2 22:31:55 | 显示全部楼层
https://hacs.xyz/docs/configuration/basic#add-your-configuration这里有详细的指导,可以先把配置文件里的hasc去掉,直接用集成里的hasc添加
回复

使用道具 举报

3

主题

37

帖子

113

积分

注册会员

Rank: 2

积分
113
金钱
76
HASS币
0
 楼主| 发表于 2020-3-2 22:43:59 | 显示全部楼层
yonghengdeshang 发表于 2020-3-2 22:31
https://hacs.xyz/docs/configuration/basic#add-your-configuration这里有详细的指导,可以先把配置文件里 ...

这个我有看了,但是集成里没有,甚至在https://www.home-assistant.io/integrations/#search/hacs 这里也没有,是不是我体质问题,node-red也启动不了,一直502: Bad Gateway 捕获.PNG 捕获2.PNG
回复

使用道具 举报

6

主题

184

帖子

1192

积分

金牌会员

Rank: 6Rank: 6

积分
1192
金钱
1008
HASS币
0
发表于 2020-3-3 14:28:13 | 显示全部楼层
。。。。。https://hacs.xyz  好好看看教程
回复

使用道具 举报

9

主题

163

帖子

1668

积分

金牌会员

Rank: 6Rank: 6

积分
1668
金钱
1500
HASS币
50
发表于 2020-5-11 22:23:06 | 显示全部楼层
配置文件放进去之后检查配置会报错,但是可以直接重启整个hassos,过程会略长,重启好了就有了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-6-2 21:36 , Processed in 0.117373 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表