mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-24 09:36:31 +00:00
commit
da513e7347
@ -7,6 +7,7 @@ from aiohttp import web
|
||||
import voluptuous as vol
|
||||
|
||||
from ..addons import AnyAddon
|
||||
from ..addons.addon import Addon
|
||||
from ..addons.utils import rating_security
|
||||
from ..const import (
|
||||
ATTR_ADDONS,
|
||||
@ -129,7 +130,10 @@ class APIAddons(CoreSysAttributes):
|
||||
|
||||
# Lookup itself
|
||||
if addon_slug == "self":
|
||||
return request.get(REQUEST_FROM)
|
||||
addon = request.get(REQUEST_FROM)
|
||||
if not isinstance(addon, Addon):
|
||||
raise APIError("Self is not an Addon")
|
||||
return addon
|
||||
|
||||
addon = self.sys_addons.get(addon_slug)
|
||||
if not addon:
|
||||
|
@ -3,7 +3,7 @@ from enum import Enum
|
||||
from ipaddress import ip_network
|
||||
from pathlib import Path
|
||||
|
||||
HASSIO_VERSION = "199"
|
||||
HASSIO_VERSION = "200"
|
||||
|
||||
|
||||
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
||||
@ -11,7 +11,7 @@ URL_HASSIO_VERSION = "https://version.home-assistant.io/{channel}.json"
|
||||
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
|
||||
|
||||
URL_HASSOS_OTA = (
|
||||
"https://github.com/home-assistant/hassos/releases/download/"
|
||||
"https://github.com/home-assistant/operating-system/releases/download/"
|
||||
"{version}/hassos_{board}-{version}.raucb"
|
||||
)
|
||||
|
||||
|
@ -115,7 +115,10 @@ class HassIO(CoreSysAttributes):
|
||||
await self.sys_addons.boot(STARTUP_SERVICES)
|
||||
|
||||
# run HomeAssistant
|
||||
if self.sys_homeassistant.boot:
|
||||
if (
|
||||
self.sys_homeassistant.boot
|
||||
and not await self.sys_homeassistant.is_running()
|
||||
):
|
||||
with suppress(HomeAssistantError):
|
||||
await self.sys_homeassistant.start()
|
||||
|
||||
|
@ -54,10 +54,16 @@ class Hardware:
|
||||
|
||||
# Exctract all devices
|
||||
for device in self.context.list_devices():
|
||||
# Skip devices without mapping
|
||||
if not device.device_node:
|
||||
continue
|
||||
|
||||
dev_list.append(
|
||||
Device(device.sys_name),
|
||||
Path(device.device_node),
|
||||
[Path(node) for node in device.device_links],
|
||||
Device(
|
||||
device.sys_name,
|
||||
Path(device.device_node),
|
||||
[Path(node) for node in device.device_links],
|
||||
)
|
||||
)
|
||||
|
||||
return dev_list
|
||||
|
@ -5,7 +5,7 @@ cchardet==2.1.5
|
||||
colorlog==4.1.0
|
||||
cpe==1.2.1
|
||||
cryptography==2.8
|
||||
docker==4.1.0
|
||||
docker==4.2.0
|
||||
gitpython==3.0.5
|
||||
packaging==20.1
|
||||
pytz==2019.3
|
||||
|
@ -90,9 +90,6 @@ function setup_test_env() {
|
||||
-e HOMEASSISTANT_REPOSITORY="homeassistant/qemux86-64-homeassistant" \
|
||||
homeassistant/amd64-hassio-supervisor:latest
|
||||
|
||||
if docker rm homeassistant 2> /dev/null; then
|
||||
echo "Cleanup HomeAssistant instance"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Start Test-Env"
|
||||
@ -100,6 +97,10 @@ echo "Start Test-Env"
|
||||
start_docker
|
||||
trap "stop_docker" ERR
|
||||
|
||||
# Clean homeassistant instance
|
||||
if docker rm -f homeassistant 2> /dev/null; then
|
||||
echo "Cleanup HomeAssistant instance"
|
||||
fi
|
||||
|
||||
build_supervisor
|
||||
install_cli
|
||||
|
10
tests/misc/test_hardware.py
Normal file
10
tests/misc/test_hardware.py
Normal file
@ -0,0 +1,10 @@
|
||||
"""Test hardware utils."""
|
||||
|
||||
from hassio.misc.hardware import Hardware
|
||||
|
||||
|
||||
def test_read_all_devices():
|
||||
"""Test to read all devices."""
|
||||
system = Hardware()
|
||||
|
||||
assert system.devices
|
Loading…
x
Reference in New Issue
Block a user