Merge branch 'master' into dev

This commit is contained in:
Pascal Vizeli 2020-08-12 16:43:18 +02:00 committed by GitHub
commit 62a574c6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 104 deletions

118
API.md
View File

@ -2,7 +2,8 @@
## Supervisor RESTful API ## Supervisor RESTful API
Interface for Home Assistant to control things from supervisor. The RESTful API for Home Assistant allows you to control things around
around the Supervisor and other components.
On error / Code 400: On error / Code 400:
@ -22,8 +23,10 @@ On success / Code 200:
} }
``` ```
For access to API you need use a authorization header with a `Bearer` token. To access the API you need use an authorization header with a `Bearer` token.
They are available for Add-ons and the Home Assistant using the `SUPERVISOR_TOKEN` environment variable.
The token is available for add-ons and Home Assistant using the
`SUPERVISOR_TOKEN` environment variable.
### Supervisor ### Supervisor
@ -33,7 +36,7 @@ This API call don't need a token.
- GET `/supervisor/info` - GET `/supervisor/info`
The addons from `addons` are only installed one. Shows the installed add-ons from `addons`.
```json ```json
{ {
@ -93,11 +96,11 @@ Optional:
- POST `/supervisor/reload` - POST `/supervisor/reload`
Reload addons/version. Reload the add-ons/version.
- GET `/supervisor/logs` - GET `/supervisor/logs`
Output is the raw docker log. Output is the raw Docker log.
- GET `/supervisor/stats` - GET `/supervisor/stats`
@ -116,7 +119,7 @@ Output is the raw docker log.
- GET `/supervisor/repair` - GET `/supervisor/repair`
Repair overlayfs issue and restore lost images Repair overlayfs issue and restore lost images.
### Snapshot ### Snapshot
@ -137,7 +140,6 @@ Repair overlayfs issue and restore lost images
``` ```
- POST `/snapshots/reload` - POST `/snapshots/reload`
- POST `/snapshots/new/upload` - POST `/snapshots/new/upload`
return: return:
@ -211,9 +213,7 @@ return:
``` ```
- POST `/snapshots/{slug}/remove` - POST `/snapshots/{slug}/remove`
- GET `/snapshots/{slug}/download` - GET `/snapshots/{slug}/download`
- POST `/snapshots/{slug}/restore/full` - POST `/snapshots/{slug}/restore/full`
```json ```json
@ -236,11 +236,8 @@ return:
### Host ### Host
- POST `/host/reload` - POST `/host/reload`
- POST `/host/shutdown` - POST `/host/shutdown`
- POST `/host/reboot` - POST `/host/reboot`
- GET `/host/info` - GET `/host/info`
```json ```json
@ -257,7 +254,7 @@ return:
- GET `/host/logs` - GET `/host/logs`
Return host dmesg Return the host log messages (dmesg).
- POST `/host/options` - POST `/host/options`
@ -314,7 +311,7 @@ Return host dmesg
- POST `/os/config/sync` - POST `/os/config/sync`
Load host configs from a USB stick. Load host configurations from an USB stick.
### Hardware ### Hardware
@ -357,7 +354,7 @@ Load host configs from a USB stick.
- POST `/hardware/trigger` - POST `/hardware/trigger`
Trigger an udev reload Trigger an UDEV reload.
### Home Assistant ### Home Assistant
@ -417,7 +414,7 @@ Output is the raw Docker log.
} }
``` ```
Image with `null` and version_latest with `null` reset this options. Image with `null` and `version_latest` with `null` reset this options.
- POST/GET `/core/api` - POST/GET `/core/api`
@ -554,13 +551,9 @@ Get all available add-ons.
``` ```
- GET `/addons/{addon}/icon` - GET `/addons/{addon}/icon`
- GET `/addons/{addon}/logo` - GET `/addons/{addon}/logo`
- GET `/addons/{addon}/changelog` - GET `/addons/{addon}/changelog`
- GET `/addons/{addon}/documentation` - GET `/addons/{addon}/documentation`
- POST `/addons/{addon}/options` - POST `/addons/{addon}/options`
```json ```json
@ -577,7 +570,7 @@ Get all available add-ons.
} }
``` ```
Reset custom network/audio/options, set it `null`. Reset custom network, audio and options, set it to `null`.
- POST `/addons/{addon}/security` - POST `/addons/{addon}/security`
@ -590,28 +583,22 @@ This function is not callable by itself.
``` ```
- POST `/addons/{addon}/start` - POST `/addons/{addon}/start`
- POST `/addons/{addon}/stop` - POST `/addons/{addon}/stop`
- POST `/addons/{addon}/install` - POST `/addons/{addon}/install`
- POST `/addons/{addon}/uninstall` - POST `/addons/{addon}/uninstall`
- POST `/addons/{addon}/update` - POST `/addons/{addon}/update`
- GET `/addons/{addon}/logs` - GET `/addons/{addon}/logs`
Output is the raw Docker log. Output is the raw Docker log.
- POST `/addons/{addon}/restart` - POST `/addons/{addon}/restart`
- POST `/addons/{addon}/rebuild` - POST `/addons/{addon}/rebuild`
Only supported for local build addons Only supported for local build add-ons.
- POST `/addons/{addon}/stdin` - POST `/addons/{addon}/stdin`
Write data to add-on stdin Write data to add-on stdin.
- GET `/addons/{addon}/stats` - GET `/addons/{addon}/stats`
@ -632,7 +619,7 @@ Write data to add-on stdin
- POST `/ingress/session` - POST `/ingress/session`
Create a new Session for access to ingress service. Create a new session for access to the ingress service.
```json ```json
{ {
@ -659,8 +646,8 @@ Return a list of enabled panels.
- VIEW `/ingress/{token}` - VIEW `/ingress/{token}`
Ingress WebUI for this Add-on. The addon need support HASS Auth! Ingress WebUI for this add-on. The add-on need support for the Home Assistant
Need ingress session as cookie. authentication system. Needs an ingress session as cookie.
### discovery ### discovery
@ -858,57 +845,6 @@ return:
} }
``` ```
### DNS
- GET `/dns/info`
```json
{
"host": "ip-address",
"version": "1",
"version_latest": "2",
"servers": ["dns://8.8.8.8"],
"locals": ["dns://xy"]
}
```
- POST `/dns/options`
```json
{
"servers": ["dns://8.8.8.8"]
}
```
- POST `/dns/update`
```json
{
"version": "VERSION"
}
```
- POST `/dns/restart`
- POST `/dns/reset`
- GET `/dns/logs`
- GET `/dns/stats`
```json
{
"cpu_percent": 0.0,
"memory_usage": 283123,
"memory_limit": 329392,
"memory_percent": 1.4,
"network_tx": 0,
"network_rx": 0,
"blk_read": 0,
"blk_write": 0
}
```
### CLI ### CLI
- GET `/cli/info` - GET `/cli/info`
@ -1172,18 +1108,18 @@ return:
} }
``` ```
### Auth / SSO API ### Authentication/SSO API
You can use the user system on homeassistant. We handle this auth system on You can use the user system from Home Assistant. The auth system can be handled
supervisor. with the Supervisor.
You can call post `/auth` `/auth` is accepting POST calls.
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 - Basic Authentication
* POST `/auth/reset` * POST `/auth/reset`

View File

@ -2,25 +2,25 @@
## First private cloud solution for home automation ## First private cloud solution for home automation
Hass.io is a Docker-based system for managing your Home Assistant installation Home Assistant (former Hass.io) is a container-based system for managing your
and related applications. The system is controlled via Home Assistant which Home Assistant Core installation and related applications. The system is
communicates with the Supervisor. The Supervisor provides an API to manage the controlled via Home Assistant which communicates with the Supervisor. The
installation. This includes changing network settings or installing Supervisor provides an API to manage the installation. This includes changing
and updating software. network settings or installing and updating software.
## Installation ## Installation
Installation instructions can be found at <https://home-assistant.io/hassio>. Installation instructions can be found at https://home-assistant.io/hassio.
## Development ## Development
The development of the supervisor is a bit tricky. Not difficult but tricky. The development of the Supervisor is not difficult but tricky.
- You can use the builder to build your supervisor: https://github.com/home-assistant/hassio-builder - You can use the builder to create your Supervisor: https://github.com/home-assistant/hassio-builder
- Go into a HassOS device or VM and pull your supervisor. - Access a HassOS device or VM and pull your Supervisor.
- Set the developer modus with cli `hassio supervisor options --channel=dev` - Set the developer modus with the CLI tool: `ha supervisor options --channel=dev`
- Tag it as `homeassistant/xy-hassio-supervisor:latest` - Tag it as `homeassistant/xy-hassio-supervisor:latest`
- Restart the service like `systemctl restart hassos-supervisor | journalctl -fu hassos-supervisor` - Restart the service with `systemctl restart hassos-supervisor | journalctl -fu hassos-supervisor`
- Test your changes - Test your changes
Small Bugfix or improvements, make a PR. Significant change makes first an RFC. For small bugfixes or improvements, make a PR. For significant changes open a RFC first, please. Thanks.

View File

@ -3,8 +3,8 @@ from enum import Enum
from ipaddress import ip_network from ipaddress import ip_network
from pathlib import Path from pathlib import Path
SUPERVISOR_VERSION = "232"
SUPERVISOR_VERSION = "232"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
URL_HASSIO_VERSION = "https://version.home-assistant.io/{channel}.json" URL_HASSIO_VERSION = "https://version.home-assistant.io/{channel}.json"