Report whether SSL is required in discoverables, like /api/discovery_info and ZeroConf (#2192)

pull/2196/head
Robbie Trencheny 2016-06-01 19:45:19 -07:00
parent 4e064f91fd
commit c856c67790
3 changed files with 6 additions and 3 deletions

View File

@ -167,7 +167,8 @@ class APIDiscoveryView(HomeAssistantView):
'base_url': self.hass.config.api.base_url, 'base_url': self.hass.config.api.base_url,
'location_name': self.hass.config.location_name, 'location_name': self.hass.config.location_name,
'requires_api_password': needs_auth, 'requires_api_password': needs_auth,
'version': __version__ 'version': __version__,
'use_ssl': self.hass.config.api.use_ssl
}) })

View File

@ -33,7 +33,8 @@ def setup(hass, config):
requires_api_password = (hass.config.api.api_password is not None) requires_api_password = (hass.config.api.api_password is not None)
params = {"version": __version__, "base_url": hass.config.api.base_url, params = {"version": __version__, "base_url": hass.config.api.base_url,
"requires_api_password": requires_api_password} "requires_api_password": requires_api_password,
"use_ssl": hass.config.api.use_ssl}
info = ServiceInfo(ZEROCONF_TYPE, zeroconf_name, info = ServiceInfo(ZEROCONF_TYPE, zeroconf_name,
socket.inet_aton(hass.config.api.host), socket.inet_aton(hass.config.api.host),

View File

@ -55,7 +55,8 @@ class API(object):
self.host = host self.host = host
self.port = port or SERVER_PORT self.port = port or SERVER_PORT
self.api_password = api_password self.api_password = api_password
if use_ssl: self.use_ssl = use_ssl
if self.use_ssl:
self.base_url = "https://{}:{}".format(host, self.port) self.base_url = "https://{}:{}".format(host, self.port)
else: else:
self.base_url = "http://{}:{}".format(host, self.port) self.base_url = "http://{}:{}".format(host, self.port)