8000 HassIO replace config changes by pvizeli · Pull Request #9695 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HassIO replace config changes #9695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions homeassistant/components/hassio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONTENT_TYPE_TEXT_PLAIN
from homeassistant.const import CONTENT_TYPE_TEXT_PLAIN, SERVER_PORT
from homeassistant.components.http import (
HomeAssistantView, KEY_AUTHENTICATED, CONF_API_PASSWORD, CONF_SERVER_PORT,
CONF_SSL_CERTIFICATE)
Expand Down Expand Up @@ -129,16 +129,13 @@ def update_hass_api(self, http_config):

This method return a coroutine.
"""
port = http_config.get(CONF_SERVER_PORT) or SERVER_PORT
options = {
'ssl': CONF_SSL_CERTIFICATE in http_config,
'port': port,
'password': http_config.get(CONF_API_PASSWORD),
}

if http_config.get(CONF_SERVER_PORT):
options['port'] = http_config[CONF_SERVER_PORT]

if http_config.get(CONF_API_PASSWORD):
options['password'] = http_config[CONF_API_PASSWORD]

return self.send_command("/homeassistant/options", payload=options)

@asyncio.coroutine
Expand Down
4 changes: 2 additions & 2 deletions tests/components/test_hassio.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def test_setup_api_push_api_data_default(hass, aioclient_mock):

assert aioclient_mock.call_count == 2
assert not aioclient_mock.mock_calls[-1][2]['ssl']
assert 'password' not in aioclient_mock.mock_calls[-1][2]
assert 'port' not in aioclient_mock.mock_calls[-1][2]
assert aioclient_mock.mock_calls[-1][2]['password'] is None
assert aioclient_mock.mock_calls[-1][2]['port'] == 8123


@asyncio.coroutine
Expand Down
0