From c856c677906003919e5638fea2d8a450a742d4ec Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Wed, 1 Jun 2016 19:45:19 -0700 Subject: [PATCH] Report whether SSL is required in discoverables, like /api/discovery_info and ZeroConf (#2192) --- homeassistant/components/api.py | 3 ++- homeassistant/components/zeroconf.py | 3 ++- homeassistant/remote.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/api.py b/homeassistant/components/api.py index ad8f21f069b..0b957599298 100644 --- a/homeassistant/components/api.py +++ b/homeassistant/components/api.py @@ -167,7 +167,8 @@ class APIDiscoveryView(HomeAssistantView): 'base_url': self.hass.config.api.base_url, 'location_name': self.hass.config.location_name, 'requires_api_password': needs_auth, - 'version': __version__ + 'version': __version__, + 'use_ssl': self.hass.config.api.use_ssl }) diff --git a/homeassistant/components/zeroconf.py b/homeassistant/components/zeroconf.py index 0d9cd02aa1c..30b75a1de47 100644 --- a/homeassistant/components/zeroconf.py +++ b/homeassistant/components/zeroconf.py @@ -33,7 +33,8 @@ def setup(hass, config): requires_api_password = (hass.config.api.api_password is not None) 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, socket.inet_aton(hass.config.api.host), diff --git a/homeassistant/remote.py b/homeassistant/remote.py index 4bfb01890cf..9ded5e7ead5 100644 --- a/homeassistant/remote.py +++ b/homeassistant/remote.py @@ -55,7 +55,8 @@ class API(object): self.host = host self.port = port or SERVER_PORT 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) else: self.base_url = "http://{}:{}".format(host, self.port)