Allow map special device to homeassistant docker (#75)

* Allow map special device to homeassistant docker

* fix lint

* fix '/dev/'
This commit is contained in:
Pascal Vizeli
2017-06-02 23:39:54 +02:00
committed by GitHub
parent 1aa24e40ae
commit d15b6f0294
5 changed files with 54 additions and 2 deletions

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."""