mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-22 00:26:29 +00:00
Offload rauc logic with partition handling (#1404)
* Offload rauc logic with partition handling * Fix name * Fix detection * Add to API
This commit is contained in:
parent
a0d106529c
commit
5365aa4466
654
API.md
654
API.md
@ -8,8 +8,8 @@ On error / Code 400:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"result": "error",
|
"result": "error",
|
||||||
"message": ""
|
"message": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ On success / Code 200:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"result": "ok",
|
"result": "ok",
|
||||||
"data": { }
|
"data": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -36,32 +36,30 @@ The addons from `addons` are only installed one.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "INSTALL_VERSION",
|
"version": "INSTALL_VERSION",
|
||||||
"last_version": "LAST_VERSION",
|
"last_version": "LAST_VERSION",
|
||||||
"arch": "armhf|aarch64|i386|amd64",
|
"arch": "armhf|aarch64|i386|amd64",
|
||||||
"channel": "stable|beta|dev",
|
"channel": "stable|beta|dev",
|
||||||
"timezone": "TIMEZONE",
|
"timezone": "TIMEZONE",
|
||||||
"logging": "debug|info|warning|error|critical",
|
"logging": "debug|info|warning|error|critical",
|
||||||
"ip_address": "ip address",
|
"ip_address": "ip address",
|
||||||
"wait_boot": "int",
|
"wait_boot": "int",
|
||||||
"debug": "bool",
|
"debug": "bool",
|
||||||
"debug_block": "bool",
|
"debug_block": "bool",
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "xy bla",
|
"name": "xy bla",
|
||||||
"slug": "xy",
|
"slug": "xy",
|
||||||
"description": "description",
|
"description": "description",
|
||||||
"repository": "12345678|null",
|
"repository": "12345678|null",
|
||||||
"version": "LAST_VERSION",
|
"version": "LAST_VERSION",
|
||||||
"installed": "INSTALL_VERSION",
|
"installed": "INSTALL_VERSION",
|
||||||
"icon": "bool",
|
"icon": "bool",
|
||||||
"logo": "bool",
|
"logo": "bool",
|
||||||
"state": "started|stopped",
|
"state": "started|stopped"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"addons_repositories": [
|
"addons_repositories": ["REPO_URL"]
|
||||||
"REPO_URL"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -71,7 +69,7 @@ Optional:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "VERSION"
|
"version": "VERSION"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -79,15 +77,13 @@ Optional:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"channel": "stable|beta|dev",
|
"channel": "stable|beta|dev",
|
||||||
"timezone": "TIMEZONE",
|
"timezone": "TIMEZONE",
|
||||||
"wait_boot": "int",
|
"wait_boot": "int",
|
||||||
"debug": "bool",
|
"debug": "bool",
|
||||||
"debug_block": "bool",
|
"debug_block": "bool",
|
||||||
"logging": "debug|info|warning|error|critical",
|
"logging": "debug|info|warning|error|critical",
|
||||||
"addons_repositories": [
|
"addons_repositories": ["REPO_URL"]
|
||||||
"REPO_URL"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,16 +96,17 @@ Reload addons/version.
|
|||||||
Output is the raw docker log.
|
Output is the raw docker log.
|
||||||
|
|
||||||
- GET `/supervisor/stats`
|
- GET `/supervisor/stats`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"cpu_percent": 0.0,
|
"cpu_percent": 0.0,
|
||||||
"memory_usage": 283123,
|
"memory_usage": 283123,
|
||||||
"memory_limit": 329392,
|
"memory_limit": 329392,
|
||||||
"memory_percent": 1.4,
|
"memory_percent": 1.4,
|
||||||
"network_tx": 0,
|
"network_tx": 0,
|
||||||
"network_rx": 0,
|
"network_rx": 0,
|
||||||
"blk_read": 0,
|
"blk_read": 0,
|
||||||
"blk_write": 0
|
"blk_write": 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -123,15 +120,15 @@ Repair overlayfs issue and restore lost images
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"snapshots": [
|
"snapshots": [
|
||||||
{
|
{
|
||||||
"slug": "SLUG",
|
"slug": "SLUG",
|
||||||
"date": "ISO",
|
"date": "ISO",
|
||||||
"name": "Custom name",
|
"name": "Custom name",
|
||||||
"type": "full|partial",
|
"type": "full|partial",
|
||||||
"protected": "bool"
|
"protected": "bool"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -140,9 +137,10 @@ Repair overlayfs issue and restore lost images
|
|||||||
- POST `/snapshots/new/upload`
|
- POST `/snapshots/new/upload`
|
||||||
|
|
||||||
return:
|
return:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"slug": ""
|
"slug": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -150,15 +148,16 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "Optional",
|
"name": "Optional",
|
||||||
"password": "Optional"
|
"password": "Optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
return:
|
return:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"slug": ""
|
"slug": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -166,17 +165,18 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "Optional",
|
"name": "Optional",
|
||||||
"addons": ["ADDON_SLUG"],
|
"addons": ["ADDON_SLUG"],
|
||||||
"folders": ["FOLDER_NAME"],
|
"folders": ["FOLDER_NAME"],
|
||||||
"password": "Optional"
|
"password": "Optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
return:
|
return:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"slug": ""
|
"slug": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -186,23 +186,23 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"slug": "SNAPSHOT ID",
|
"slug": "SNAPSHOT ID",
|
||||||
"type": "full|partial",
|
"type": "full|partial",
|
||||||
"name": "custom snapshot name / description",
|
"name": "custom snapshot name / description",
|
||||||
"date": "ISO",
|
"date": "ISO",
|
||||||
"size": "SIZE_IN_MB",
|
"size": "SIZE_IN_MB",
|
||||||
"protected": "bool",
|
"protected": "bool",
|
||||||
"homeassistant": "version",
|
"homeassistant": "version",
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"slug": "ADDON_SLUG",
|
"slug": "ADDON_SLUG",
|
||||||
"name": "NAME",
|
"name": "NAME",
|
||||||
"version": "INSTALLED_VERSION",
|
"version": "INSTALLED_VERSION",
|
||||||
"size": "SIZE_IN_MB"
|
"size": "SIZE_IN_MB"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repositories": ["URL"],
|
"repositories": ["URL"],
|
||||||
"folders": ["NAME"]
|
"folders": ["NAME"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"password": "Optional"
|
"password": "Optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -222,10 +222,10 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"homeassistant": "bool",
|
"homeassistant": "bool",
|
||||||
"addons": ["ADDON_SLUG"],
|
"addons": ["ADDON_SLUG"],
|
||||||
"folders": ["FOLDER_NAME"],
|
"folders": ["FOLDER_NAME"],
|
||||||
"password": "Optional"
|
"password": "Optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -241,13 +241,13 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"hostname": "hostname|null",
|
"hostname": "hostname|null",
|
||||||
"features": ["shutdown", "reboot", "hostname", "services", "hassos"],
|
"features": ["shutdown", "reboot", "hostname", "services", "hassos"],
|
||||||
"operating_system": "HassOS XY|Ubuntu 16.4|null",
|
"operating_system": "HassOS XY|Ubuntu 16.4|null",
|
||||||
"kernel": "4.15.7|null",
|
"kernel": "4.15.7|null",
|
||||||
"chassis": "specific|null",
|
"chassis": "specific|null",
|
||||||
"deployment": "stable|beta|dev|null",
|
"deployment": "stable|beta|dev|null",
|
||||||
"cpe": "xy|null",
|
"cpe": "xy|null"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"hostname": "",
|
"hostname": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -264,15 +264,16 @@ return:
|
|||||||
#### Services
|
#### Services
|
||||||
|
|
||||||
- GET `/host/services`
|
- GET `/host/services`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"name": "xy.service",
|
"name": "xy.service",
|
||||||
"description": "XY ...",
|
"description": "XY ...",
|
||||||
"state": "active|"
|
"state": "active|"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -285,27 +286,31 @@ return:
|
|||||||
### HassOS
|
### HassOS
|
||||||
|
|
||||||
- GET `/hassos/info`
|
- GET `/hassos/info`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "2.3",
|
"version": "2.3",
|
||||||
"version_cli": "7",
|
"version_cli": "7",
|
||||||
"version_latest": "2.4",
|
"version_latest": "2.4",
|
||||||
"version_cli_latest": "8",
|
"version_cli_latest": "8",
|
||||||
"board": "ova|rpi"
|
"board": "ova|rpi",
|
||||||
|
"boot": "rauc boot slot"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/hassos/update`
|
- POST `/hassos/update`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "optional"
|
"version": "optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/hassos/update/cli`
|
- POST `/hassos/update/cli`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "optional"
|
"version": "optional"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -316,6 +321,7 @@ Load host configs from a USB stick.
|
|||||||
### Hardware
|
### Hardware
|
||||||
|
|
||||||
- GET `/hardware/info`
|
- GET `/hardware/info`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"serial": ["/dev/xy"],
|
"serial": ["/dev/xy"],
|
||||||
@ -336,17 +342,18 @@ Load host configs from a USB stick.
|
|||||||
```
|
```
|
||||||
|
|
||||||
- GET `/hardware/audio`
|
- GET `/hardware/audio`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"audio": {
|
"audio": {
|
||||||
"input": {
|
"input": {
|
||||||
"0,0": "Mic"
|
"0,0": "Mic"
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"1,0": "Jack",
|
"1,0": "Jack",
|
||||||
"1,1": "HDMI"
|
"1,1": "HDMI"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -360,18 +367,18 @@ Trigger an udev reload
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "INSTALL_VERSION",
|
"version": "INSTALL_VERSION",
|
||||||
"last_version": "LAST_VERSION",
|
"last_version": "LAST_VERSION",
|
||||||
"arch": "arch",
|
"arch": "arch",
|
||||||
"machine": "Image machine type",
|
"machine": "Image machine type",
|
||||||
"ip_address": "ip address",
|
"ip_address": "ip address",
|
||||||
"image": "str",
|
"image": "str",
|
||||||
"custom": "bool -> if custom image",
|
"custom": "bool -> if custom image",
|
||||||
"boot": "bool",
|
"boot": "bool",
|
||||||
"port": 8123,
|
"port": 8123,
|
||||||
"ssl": "bool",
|
"ssl": "bool",
|
||||||
"watchdog": "bool",
|
"watchdog": "bool",
|
||||||
"wait_boot": 600
|
"wait_boot": 600
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -381,7 +388,7 @@ Optional:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "VERSION"
|
"version": "VERSION"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -399,14 +406,14 @@ Output is the raw Docker log.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"image": "Optional|null",
|
"image": "Optional|null",
|
||||||
"last_version": "Optional for custom image|null",
|
"last_version": "Optional for custom image|null",
|
||||||
"port": "port for access hass",
|
"port": "port for access hass",
|
||||||
"ssl": "bool",
|
"ssl": "bool",
|
||||||
"password": "",
|
"password": "",
|
||||||
"refresh_token": "",
|
"refresh_token": "",
|
||||||
"watchdog": "bool",
|
"watchdog": "bool",
|
||||||
"wait_boot": 600
|
"wait_boot": 600
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -421,16 +428,17 @@ Proxy to real home-assistant instance.
|
|||||||
Proxy to real websocket instance.
|
Proxy to real websocket instance.
|
||||||
|
|
||||||
- GET `/homeassistant/stats`
|
- GET `/homeassistant/stats`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"cpu_percent": 0.0,
|
"cpu_percent": 0.0,
|
||||||
"memory_usage": 283123,
|
"memory_usage": 283123,
|
||||||
"memory_limit": 329392,
|
"memory_limit": 329392,
|
||||||
"memory_percent": 1.4,
|
"memory_percent": 1.4,
|
||||||
"network_tx": 0,
|
"network_tx": 0,
|
||||||
"network_rx": 0,
|
"network_rx": 0,
|
||||||
"blk_read": 0,
|
"blk_read": 0,
|
||||||
"blk_write": 0
|
"blk_write": 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -444,31 +452,31 @@ Get all available addons.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "xy bla",
|
"name": "xy bla",
|
||||||
"slug": "xy",
|
"slug": "xy",
|
||||||
"description": "description",
|
"description": "description",
|
||||||
"repository": "core|local|REP_ID",
|
"repository": "core|local|REP_ID",
|
||||||
"version": "LAST_VERSION",
|
"version": "LAST_VERSION",
|
||||||
"installed": "none|INSTALL_VERSION",
|
"installed": "none|INSTALL_VERSION",
|
||||||
"detached": "bool",
|
"detached": "bool",
|
||||||
"available": "bool",
|
"available": "bool",
|
||||||
"build": "bool",
|
"build": "bool",
|
||||||
"url": "null|url",
|
"url": "null|url",
|
||||||
"icon": "bool",
|
"icon": "bool",
|
||||||
"logo": "bool"
|
"logo": "bool"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"slug": "12345678",
|
"slug": "12345678",
|
||||||
"name": "Repitory Name|unknown",
|
"name": "Repitory Name|unknown",
|
||||||
"source": "URL_OF_REPOSITORY",
|
"source": "URL_OF_REPOSITORY",
|
||||||
"url": "WEBSITE|REPOSITORY",
|
"url": "WEBSITE|REPOSITORY",
|
||||||
"maintainer": "BLA BLU <fla@dld.ch>|unknown"
|
"maintainer": "BLA BLU <fla@dld.ch>|unknown"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -477,64 +485,64 @@ Get all available addons.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "xy bla",
|
"name": "xy bla",
|
||||||
"slug": "xdssd_xybla",
|
"slug": "xdssd_xybla",
|
||||||
"hostname": "xdssd-xybla",
|
"hostname": "xdssd-xybla",
|
||||||
"dns": [],
|
"dns": [],
|
||||||
"description": "description",
|
"description": "description",
|
||||||
"long_description": "null|markdown",
|
"long_description": "null|markdown",
|
||||||
"auto_update": "bool",
|
"auto_update": "bool",
|
||||||
"url": "null|url of addon",
|
"url": "null|url of addon",
|
||||||
"detached": "bool",
|
"detached": "bool",
|
||||||
"available": "bool",
|
"available": "bool",
|
||||||
"arch": ["armhf", "aarch64", "i386", "amd64"],
|
"arch": ["armhf", "aarch64", "i386", "amd64"],
|
||||||
"machine": "[raspberrypi2, tinker]",
|
"machine": "[raspberrypi2, tinker]",
|
||||||
"homeassistant": "null|min Home Assistant version",
|
"homeassistant": "null|min Home Assistant version",
|
||||||
"repository": "12345678|null",
|
"repository": "12345678|null",
|
||||||
"version": "null|VERSION_INSTALLED",
|
"version": "null|VERSION_INSTALLED",
|
||||||
"last_version": "LAST_VERSION",
|
"last_version": "LAST_VERSION",
|
||||||
"state": "none|started|stopped",
|
"state": "none|started|stopped",
|
||||||
"boot": "auto|manual",
|
"boot": "auto|manual",
|
||||||
"build": "bool",
|
"build": "bool",
|
||||||
"options": "{}",
|
"options": "{}",
|
||||||
"network": "{}|null",
|
"network": "{}|null",
|
||||||
"network_description": "{}|null",
|
"network_description": "{}|null",
|
||||||
"host_network": "bool",
|
"host_network": "bool",
|
||||||
"host_pid": "bool",
|
"host_pid": "bool",
|
||||||
"host_ipc": "bool",
|
"host_ipc": "bool",
|
||||||
"host_dbus": "bool",
|
"host_dbus": "bool",
|
||||||
"privileged": ["NET_ADMIN", "SYS_ADMIN"],
|
"privileged": ["NET_ADMIN", "SYS_ADMIN"],
|
||||||
"apparmor": "disable|default|profile",
|
"apparmor": "disable|default|profile",
|
||||||
"devices": ["/dev/xy"],
|
"devices": ["/dev/xy"],
|
||||||
"udev": "bool",
|
"udev": "bool",
|
||||||
"auto_uart": "bool",
|
"auto_uart": "bool",
|
||||||
"icon": "bool",
|
"icon": "bool",
|
||||||
"logo": "bool",
|
"logo": "bool",
|
||||||
"changelog": "bool",
|
"changelog": "bool",
|
||||||
"hassio_api": "bool",
|
"hassio_api": "bool",
|
||||||
"hassio_role": "default|homeassistant|manager|admin",
|
"hassio_role": "default|homeassistant|manager|admin",
|
||||||
"homeassistant_api": "bool",
|
"homeassistant_api": "bool",
|
||||||
"auth_api": "bool",
|
"auth_api": "bool",
|
||||||
"full_access": "bool",
|
"full_access": "bool",
|
||||||
"protected": "bool",
|
"protected": "bool",
|
||||||
"rating": "1-6",
|
"rating": "1-6",
|
||||||
"stdin": "bool",
|
"stdin": "bool",
|
||||||
"webui": "null|http(s)://[HOST]:port/xy/zx",
|
"webui": "null|http(s)://[HOST]:port/xy/zx",
|
||||||
"gpio": "bool",
|
"gpio": "bool",
|
||||||
"kernel_modules": "bool",
|
"kernel_modules": "bool",
|
||||||
"devicetree": "bool",
|
"devicetree": "bool",
|
||||||
"docker_api": "bool",
|
"docker_api": "bool",
|
||||||
"audio": "bool",
|
"audio": "bool",
|
||||||
"audio_input": "null|0,0",
|
"audio_input": "null|0,0",
|
||||||
"audio_output": "null|0,0",
|
"audio_output": "null|0,0",
|
||||||
"services_role": "['service:access']",
|
"services_role": "['service:access']",
|
||||||
"discovery": "['service']",
|
"discovery": "['service']",
|
||||||
"ip_address": "ip address",
|
"ip_address": "ip address",
|
||||||
"ingress": "bool",
|
"ingress": "bool",
|
||||||
"ingress_entry": "null|/api/hassio_ingress/slug",
|
"ingress_entry": "null|/api/hassio_ingress/slug",
|
||||||
"ingress_url": "null|/api/hassio_ingress/slug/entry.html",
|
"ingress_url": "null|/api/hassio_ingress/slug/entry.html",
|
||||||
"ingress_port": "null|int",
|
"ingress_port": "null|int",
|
||||||
"ingress_panel": "null|bool"
|
"ingress_panel": "null|bool"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -548,15 +556,15 @@ Get all available addons.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"boot": "auto|manual",
|
"boot": "auto|manual",
|
||||||
"auto_update": "bool",
|
"auto_update": "bool",
|
||||||
"network": {
|
"network": {
|
||||||
"CONTAINER": "port|[ip, port]"
|
"CONTAINER": "port|[ip, port]"
|
||||||
},
|
},
|
||||||
"options": {},
|
"options": {},
|
||||||
"audio_output": "null|0,0",
|
"audio_output": "null|0,0",
|
||||||
"audio_input": "null|0,0",
|
"audio_input": "null|0,0",
|
||||||
"ingress_panel": "bool"
|
"ingress_panel": "bool"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -568,7 +576,7 @@ This function is not callable by itself.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"protected": "bool",
|
"protected": "bool"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -597,16 +605,17 @@ Only supported for local build addons
|
|||||||
Write data to add-on stdin
|
Write data to add-on stdin
|
||||||
|
|
||||||
- GET `/addons/{addon}/stats`
|
- GET `/addons/{addon}/stats`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"cpu_percent": 0.0,
|
"cpu_percent": 0.0,
|
||||||
"memory_usage": 283123,
|
"memory_usage": 283123,
|
||||||
"memory_limit": 329392,
|
"memory_limit": 329392,
|
||||||
"memory_percent": 1.4,
|
"memory_percent": 1.4,
|
||||||
"network_tx": 0,
|
"network_tx": 0,
|
||||||
"network_rx": 0,
|
"network_rx": 0,
|
||||||
"blk_read": 0,
|
"blk_read": 0,
|
||||||
"blk_write": 0
|
"blk_write": 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -618,7 +627,7 @@ Create a new Session for access to ingress service.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"session": "token"
|
"session": "token"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -628,14 +637,14 @@ Return a list of enabled panels.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"panels": {
|
"panels": {
|
||||||
"addon_slug": {
|
"addon_slug": {
|
||||||
"enable": "boolean",
|
"enable": "boolean",
|
||||||
"icon": "mdi:...",
|
"icon": "mdi:...",
|
||||||
"title": "title",
|
"title": "title",
|
||||||
"admin": "boolean"
|
"admin": "boolean"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -647,41 +656,45 @@ Need ingress session as cookie.
|
|||||||
### discovery
|
### discovery
|
||||||
|
|
||||||
- GET `/discovery`
|
- GET `/discovery`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"discovery": [
|
"discovery": [
|
||||||
{
|
{
|
||||||
"addon": "slug",
|
"addon": "slug",
|
||||||
"service": "name",
|
"service": "name",
|
||||||
"uuid": "uuid",
|
"uuid": "uuid",
|
||||||
"config": {}
|
"config": {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- GET `/discovery/{UUID}`
|
- GET `/discovery/{UUID}`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"addon": "slug",
|
"addon": "slug",
|
||||||
"service": "name",
|
"service": "name",
|
||||||
"uuid": "uuid",
|
"uuid": "uuid",
|
||||||
"config": {}
|
"config": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/discovery`
|
- POST `/discovery`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"service": "name",
|
"service": "name",
|
||||||
"config": {}
|
"config": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
return:
|
return:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"uuid": "uuid"
|
"uuid": "uuid"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -690,42 +703,45 @@ return:
|
|||||||
### Services
|
### Services
|
||||||
|
|
||||||
- GET `/services`
|
- GET `/services`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"slug": "name",
|
"slug": "name",
|
||||||
"available": "bool",
|
"available": "bool",
|
||||||
"providers": "list"
|
"providers": "list"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### MQTT
|
#### MQTT
|
||||||
|
|
||||||
- GET `/services/mqtt`
|
- GET `/services/mqtt`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"addon": "name",
|
"addon": "name",
|
||||||
"host": "xy",
|
"host": "xy",
|
||||||
"port": "8883",
|
"port": "8883",
|
||||||
"ssl": "bool",
|
"ssl": "bool",
|
||||||
"username": "optional",
|
"username": "optional",
|
||||||
"password": "optional",
|
"password": "optional",
|
||||||
"protocol": "3.1.1"
|
"protocol": "3.1.1"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/services/mqtt`
|
- POST `/services/mqtt`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"host": "xy",
|
"host": "xy",
|
||||||
"port": "8883",
|
"port": "8883",
|
||||||
"ssl": "bool|optional",
|
"ssl": "bool|optional",
|
||||||
"username": "optional",
|
"username": "optional",
|
||||||
"password": "optional",
|
"password": "optional",
|
||||||
"protocol": "3.1.1"
|
"protocol": "3.1.1"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -734,45 +750,49 @@ return:
|
|||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
- GET `/info`
|
- GET `/info`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"supervisor": "version",
|
"supervisor": "version",
|
||||||
"homeassistant": "version",
|
"homeassistant": "version",
|
||||||
"hassos": "null|version",
|
"hassos": "null|version",
|
||||||
"hostname": "name",
|
"hostname": "name",
|
||||||
"machine": "type",
|
"machine": "type",
|
||||||
"arch": "arch",
|
"arch": "arch",
|
||||||
"supported_arch": ["arch1", "arch2"],
|
"supported_arch": ["arch1", "arch2"],
|
||||||
"channel": "stable|beta|dev",
|
"channel": "stable|beta|dev",
|
||||||
"logging": "debug|info|warning|error|critical",
|
"logging": "debug|info|warning|error|critical",
|
||||||
"timezone": "Europe/Zurich"
|
"timezone": "Europe/Zurich"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### DNS
|
### DNS
|
||||||
|
|
||||||
- GET `/dns/info`
|
- GET `/dns/info`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"host": "ip-address",
|
"host": "ip-address",
|
||||||
"version": "1",
|
"version": "1",
|
||||||
"latest_version": "2",
|
"latest_version": "2",
|
||||||
"servers": ["dns://8.8.8.8"],
|
"servers": ["dns://8.8.8.8"],
|
||||||
"locals": ["dns://xy"]
|
"locals": ["dns://xy"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/dns/options`
|
- POST `/dns/options`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"servers": ["dns://8.8.8.8"]
|
"servers": ["dns://8.8.8.8"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- POST `/dns/update`
|
- POST `/dns/update`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "VERSION"
|
"version": "VERSION"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -781,16 +801,17 @@ return:
|
|||||||
- GET `/dns/logs`
|
- GET `/dns/logs`
|
||||||
|
|
||||||
- GET `/dns/stats`
|
- GET `/dns/stats`
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"cpu_percent": 0.0,
|
"cpu_percent": 0.0,
|
||||||
"memory_usage": 283123,
|
"memory_usage": 283123,
|
||||||
"memory_limit": 329392,
|
"memory_limit": 329392,
|
||||||
"memory_percent": 1.4,
|
"memory_percent": 1.4,
|
||||||
"network_tx": 0,
|
"network_tx": 0,
|
||||||
"network_rx": 0,
|
"network_rx": 0,
|
||||||
"blk_read": 0,
|
"blk_read": 0,
|
||||||
"blk_write": 0
|
"blk_write": 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -802,6 +823,7 @@ supervisor.
|
|||||||
You can call post `/auth`
|
You can call post `/auth`
|
||||||
|
|
||||||
We support:
|
We support:
|
||||||
|
|
||||||
- Json `{ "user|name": "...", "password": "..." }`
|
- Json `{ "user|name": "...", "password": "..." }`
|
||||||
- application/x-www-form-urlencoded `user|name=...&password=...`
|
- application/x-www-form-urlencoded `user|name=...&password=...`
|
||||||
- BasicAuth
|
- BasicAuth
|
||||||
|
@ -3,11 +3,12 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Awaitable, Dict
|
from typing import Any, Awaitable, Dict
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
from ..const import (
|
from ..const import (
|
||||||
ATTR_BOARD,
|
ATTR_BOARD,
|
||||||
|
ATTR_BOOT,
|
||||||
ATTR_VERSION,
|
ATTR_VERSION,
|
||||||
ATTR_VERSION_CLI,
|
ATTR_VERSION_CLI,
|
||||||
ATTR_VERSION_CLI_LATEST,
|
ATTR_VERSION_CLI_LATEST,
|
||||||
@ -33,6 +34,7 @@ class APIHassOS(CoreSysAttributes):
|
|||||||
ATTR_VERSION_LATEST: self.sys_hassos.version_latest,
|
ATTR_VERSION_LATEST: self.sys_hassos.version_latest,
|
||||||
ATTR_VERSION_CLI_LATEST: self.sys_hassos.version_cli_latest,
|
ATTR_VERSION_CLI_LATEST: self.sys_hassos.version_cli_latest,
|
||||||
ATTR_BOARD: self.sys_hassos.board,
|
ATTR_BOARD: self.sys_hassos.board,
|
||||||
|
ATTR_BOOT: self.sys_dbus.rauc.boot_slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
@api_process
|
@api_process
|
||||||
|
@ -79,7 +79,11 @@ class HassIO(CoreSysAttributes):
|
|||||||
"""Start Hass.io orchestration."""
|
"""Start Hass.io orchestration."""
|
||||||
await self.sys_api.start()
|
await self.sys_api.start()
|
||||||
|
|
||||||
# on release channel, try update itself
|
# Mark booted partition as healthy
|
||||||
|
if self.sys_hassos.available:
|
||||||
|
await self.sys_hassos.mark_healthy()
|
||||||
|
|
||||||
|
# On release channel, try update itself
|
||||||
if self.sys_supervisor.need_update:
|
if self.sys_supervisor.need_update:
|
||||||
try:
|
try:
|
||||||
if self.sys_dev:
|
if self.sys_dev:
|
||||||
@ -92,7 +96,7 @@ class HassIO(CoreSysAttributes):
|
|||||||
"future version of Home Assistant!"
|
"future version of Home Assistant!"
|
||||||
)
|
)
|
||||||
|
|
||||||
# start addon mark as initialize
|
# Start addon mark as initialize
|
||||||
await self.sys_addons.boot(STARTUP_INITIALIZE)
|
await self.sys_addons.boot(STARTUP_INITIALIZE)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""D-Bus interface for rauc."""
|
"""D-Bus interface for rauc."""
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
from .interface import DBusInterface
|
from .interface import DBusInterface
|
||||||
from .utils import dbus_connected
|
from .utils import dbus_connected
|
||||||
@ -13,6 +14,14 @@ DBUS_NAME = "de.pengutronix.rauc"
|
|||||||
DBUS_OBJECT = "/"
|
DBUS_OBJECT = "/"
|
||||||
|
|
||||||
|
|
||||||
|
class RaucState(str, Enum):
|
||||||
|
"""Rauc slot states."""
|
||||||
|
|
||||||
|
GOOD = "good"
|
||||||
|
BAD = "bad"
|
||||||
|
ACTIVE = "active"
|
||||||
|
|
||||||
|
|
||||||
class Rauc(DBusInterface):
|
class Rauc(DBusInterface):
|
||||||
"""Handle D-Bus interface for rauc."""
|
"""Handle D-Bus interface for rauc."""
|
||||||
|
|
||||||
@ -82,6 +91,14 @@ class Rauc(DBusInterface):
|
|||||||
"""
|
"""
|
||||||
return self.dbus.wait_signal(f"{DBUS_NAME}.Installer.Completed")
|
return self.dbus.wait_signal(f"{DBUS_NAME}.Installer.Completed")
|
||||||
|
|
||||||
|
@dbus_connected
|
||||||
|
def mark(self, state: RaucState, slot_identifier: str):
|
||||||
|
"""Get slot status.
|
||||||
|
|
||||||
|
Return a coroutine.
|
||||||
|
"""
|
||||||
|
return self.dbus.Installer.Mark(state, slot_identifier)
|
||||||
|
|
||||||
@dbus_connected
|
@dbus_connected
|
||||||
async def update(self):
|
async def update(self):
|
||||||
"""Update Properties."""
|
"""Update Properties."""
|
||||||
|
@ -427,9 +427,10 @@ class DockerInterface(CoreSysAttributes):
|
|||||||
continue
|
continue
|
||||||
available_version.append(version)
|
available_version.append(version)
|
||||||
|
|
||||||
assert available_version
|
if not available_version:
|
||||||
|
raise ValueError()
|
||||||
|
|
||||||
except (docker.errors.DockerException, AssertionError):
|
except (docker.errors.DockerException, ValueError):
|
||||||
_LOGGER.debug("No version found for %s", self.image)
|
_LOGGER.debug("No version found for %s", self.image)
|
||||||
raise DockerAPIError()
|
raise DockerAPIError()
|
||||||
else:
|
else:
|
||||||
|
@ -17,6 +17,7 @@ from .exceptions import (
|
|||||||
HassOSUpdateError,
|
HassOSUpdateError,
|
||||||
DockerAPIError,
|
DockerAPIError,
|
||||||
)
|
)
|
||||||
|
from .dbus.rauc import RaucState
|
||||||
|
|
||||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -111,20 +112,19 @@ class HassOS(CoreSysAttributes):
|
|||||||
async def load(self) -> None:
|
async def load(self) -> None:
|
||||||
"""Load HassOS data."""
|
"""Load HassOS data."""
|
||||||
try:
|
try:
|
||||||
# Check needed host functions
|
if self.sys_host.info.cpe is None:
|
||||||
assert self.sys_dbus.rauc.is_connected
|
raise TypeError()
|
||||||
assert self.sys_dbus.systemd.is_connected
|
|
||||||
assert self.sys_dbus.hostname.is_connected
|
|
||||||
|
|
||||||
assert self.sys_host.info.cpe is not None
|
|
||||||
cpe = CPE(self.sys_host.info.cpe)
|
cpe = CPE(self.sys_host.info.cpe)
|
||||||
assert cpe.get_product()[0] == "hassos"
|
|
||||||
except (AssertionError, NotImplementedError):
|
if cpe.get_product()[0] != "hassos":
|
||||||
|
raise TypeError()
|
||||||
|
except TypeError:
|
||||||
_LOGGER.debug("Found no HassOS")
|
_LOGGER.debug("Found no HassOS")
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
self._available = True
|
||||||
|
|
||||||
# Store meta data
|
# Store meta data
|
||||||
self._available = True
|
|
||||||
self._version = cpe.get_version()[0]
|
self._version = cpe.get_version()[0]
|
||||||
self._board = cpe.get_target_hardware()[0]
|
self._board = cpe.get_target_hardware()[0]
|
||||||
|
|
||||||
@ -210,3 +210,12 @@ class HassOS(CoreSysAttributes):
|
|||||||
await self.instance.install(self.version_cli, latest=True)
|
await self.instance.install(self.version_cli, latest=True)
|
||||||
except DockerAPIError:
|
except DockerAPIError:
|
||||||
_LOGGER.error("Repairing of HassOS CLI fails")
|
_LOGGER.error("Repairing of HassOS CLI fails")
|
||||||
|
|
||||||
|
async def mark_healthy(self):
|
||||||
|
"""Set booted partition as good for rauc."""
|
||||||
|
try:
|
||||||
|
response = await self.sys_dbus.rauc.mark(RaucState.GOOD, "booted")
|
||||||
|
except DBusError:
|
||||||
|
_LOGGER.error("Can't mark booted partition as healty!")
|
||||||
|
else:
|
||||||
|
_LOGGER.info("Rauc: %s - %s", self.sys_dbus.rauc.boot_slot, response[1])
|
||||||
|
@ -124,9 +124,10 @@ def secure_path(tar: tarfile.TarFile) -> Generator[tarfile.TarInfo, None, None]:
|
|||||||
for member in tar:
|
for member in tar:
|
||||||
file_path = Path(member.name)
|
file_path = Path(member.name)
|
||||||
try:
|
try:
|
||||||
assert not file_path.is_absolute()
|
if file_path.is_absolute():
|
||||||
|
raise ValueError()
|
||||||
Path("/fake", file_path).resolve().relative_to("/fake")
|
Path("/fake", file_path).resolve().relative_to("/fake")
|
||||||
except (ValueError, RuntimeError, AssertionError):
|
except (ValueError, RuntimeError):
|
||||||
_LOGGER.warning("Issue with file %s", file_path)
|
_LOGGER.warning("Issue with file %s", file_path)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user