Merge pull request #76 from home-assistant/dev

Release 0.35
This commit is contained in:
Pascal Vizeli 2017-06-03 00:01:16 +02:00 committed by GitHub
commit df8afb3337
8 changed files with 56 additions and 16 deletions

10
API.md
View File

@ -203,7 +203,8 @@ Optional:
```json
{
"version": "INSTALL_VERSION",
"last_version": "LAST_VERSION"
"last_version": "LAST_VERSION",
"devices": []
}
```
@ -221,6 +222,13 @@ Output the raw docker log
- POST `/homeassistant/restart`
- POST `/homeassistant/options`
```json
{
"devices": [],
}
```
### REST API addons
- GET `/addons/{addon}/info`

View File

@ -12,15 +12,3 @@ Hass.io is a Docker based system for managing your Home Assistant installation a
## Installation
Installation instructions can be found at [https://home-assistant.io/hassio](https://home-assistant.io/hassio).
# HomeAssistant
## SSL
All addons that create SSL certs follow the same file structure. If you use one, put follow lines in your `configuration.yaml`.
```yaml
http:
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
```

View File

@ -65,6 +65,7 @@ class RestAPI(object):
api_hass = APIHomeAssistant(self.config, self.loop, dock_homeassistant)
self.webapp.router.add_get('/homeassistant/info', api_hass.info)
self.webapp.router.add_post('/homeassistant/options', api_hass.options)
self.webapp.router.add_post('/homeassistant/update', api_hass.update)
self.webapp.router.add_post('/homeassistant/restart', api_hass.restart)
self.webapp.router.add_get('/homeassistant/logs', api_hass.logs)

View File

@ -5,10 +5,15 @@ import logging
import voluptuous as vol
from .util import api_process, api_process_raw, api_validate
from ..const import ATTR_VERSION, ATTR_LAST_VERSION
from ..const import ATTR_VERSION, ATTR_LAST_VERSION, ATTR_DEVICES
_LOGGER = logging.getLogger(__name__)
SCHEMA_OPTIONS = vol.Schema({
vol.Optional(ATTR_DEVICES): [vol.Coerce(str)],
})
SCHEMA_VERSION = vol.Schema({
vol.Optional(ATTR_VERSION): vol.Coerce(str),
})
@ -29,8 +34,19 @@ class APIHomeAssistant(object):
return {
ATTR_VERSION: self.homeassistant.version,
ATTR_LAST_VERSION: self.config.last_homeassistant,
ATTR_DEVICES: self.config.homeassistant_devices,
}
@api_process
async def options(self, request):
"""Set homeassistant options."""
body = await api_validate(SCHEMA_OPTIONS, request)
if ATTR_DEVICES in body:
self.config.homeassistant_devices = body[ATTR_DEVICES]
return True
@api_process
async def update(self, request):
"""Update homeassistant."""

View File

@ -18,6 +18,7 @@ DATETIME_FORMAT = "%Y%m%d %H:%M:%S"
HOMEASSISTANT_CONFIG = PurePath("homeassistant")
HOMEASSISTANT_LAST = 'homeassistant_last'
HOMEASSISTANT_DEVICES = 'homeassistant_devices'
HASSIO_SSL = PurePath("ssl")
HASSIO_LAST = 'hassio_last'
@ -49,6 +50,7 @@ SCHEMA_CONFIG = vol.Schema({
vol.Optional(API_ENDPOINT): vol.Coerce(str),
vol.Optional(TIMEZONE, default='UTC'): validate_timezone,
vol.Optional(HOMEASSISTANT_LAST): vol.Coerce(str),
vol.Optional(HOMEASSISTANT_DEVICES, default=[]): [vol.Coerce(str)],
vol.Optional(HASSIO_LAST): vol.Coerce(str),
vol.Optional(ADDONS_CUSTOM_LIST, default=[]): [vol.Url()],
vol.Optional(SECURITY_INITIALIZE, default=False): vol.Boolean(),
@ -134,6 +136,7 @@ class CoreConfig(Config):
def upstream_beta(self, value):
"""Set beta upstream mode."""
self._data[UPSTREAM_BETA] = bool(value)
self.save()
@property
def timezone(self):
@ -146,6 +149,17 @@ class CoreConfig(Config):
self._data[TIMEZONE] = value
self.save()
@property
def homeassistant_devices(self):
"""Return list of special device to map into homeassistant."""
return self._data[HOMEASSISTANT_DEVICES]
@homeassistant_devices.setter
def homeassistant_devices(self, value):
"""Set list of special device."""
self._data[HOMEASSISTANT_DEVICES] = value
self.save()
@property
def homeassistant_image(self):
"""Return docker homeassistant repository."""

View File

@ -1,7 +1,7 @@
"""Const file for HassIO."""
from pathlib import Path
HASSIO_VERSION = '0.34'
HASSIO_VERSION = '0.35'
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
'hassio/master/version.json')

View File

@ -22,6 +22,18 @@ class DockerHomeAssistant(DockerBase):
"""Return name of docker container."""
return HASS_DOCKER_NAME
@property
def devices(self):
"""Create list of special device to map into docker."""
if not self.config.homeassistant_devices:
return
devices = []
for device in self.config.homeassistant_devices:
devices.append("/dev/{0}:/dev/{0}:rwm".format(device))
return devices
def _run(self):
"""Run docker image.
@ -39,6 +51,7 @@ class DockerHomeAssistant(DockerBase):
name=self.name,
detach=True,
privileged=True,
devices=self.devices,
network_mode='host',
environment={
'HASSIO': self.config.api_endpoint,

View File

@ -1,5 +1,5 @@
{
"hassio": "0.34",
"hassio": "0.35",
"homeassistant": "0.45.1",
"resinos": "0.8",
"resinhup": "0.1",