Fix api_password conditional and close zeroconf when we shut down

This commit is contained in:
Robbie Trencheny 2016-04-10 17:59:21 -07:00
parent e1ffdcc5f1
commit 1de45ebe8b

View File

@ -32,7 +32,7 @@ def setup(hass, config):
ZEROCONF_TYPE)
params = {"version": __version__, "base_url": hass.config.api.base_url,
"needs_auth": (hass.config.api.api_password != "")}
"needs_auth": (hass.config.api.api_password is not None)}
info = ServiceInfo(ZEROCONF_TYPE, zeroconf_name,
socket.inet_aton(hass.config.api.host),
@ -43,6 +43,7 @@ def setup(hass, config):
def stop_zeroconf(event):
"""Stop Zeroconf."""
zeroconf.unregister_service(info)
zeroconf.close()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_zeroconf)