From a11b68c560d91cfb1af3b94b8dd088496d66a77c Mon Sep 17 00:00:00 2001
From: dasos <martin@dasos.com>
Date: Tue, 6 Dec 2016 05:37:05 +0000
Subject: [PATCH] Fix connection check (#4732)

* Fix connection check

* Release instead

* Remove if

* Update hook.py
---
 homeassistant/components/switch/hook.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/homeassistant/components/switch/hook.py b/homeassistant/components/switch/hook.py
index eba64c6aeb1..689ab675b5f 100644
--- a/homeassistant/components/switch/hook.py
+++ b/homeassistant/components/switch/hook.py
@@ -50,7 +50,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
         return False
     finally:
         if response is not None:
-            yield from response.close()
+            yield from response.release()
 
     try:
         token = data['data']['token']
@@ -72,7 +72,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
         return False
     finally:
         if response is not None:
-            yield from response.close()
+            yield from response.release()
 
     yield from async_add_devices(
         HookSmartHome(
@@ -127,7 +127,7 @@ class HookSmartHome(SwitchDevice):
 
         finally:
             if response is not None:
-                yield from response.close()
+                yield from response.release()
 
         _LOGGER.debug("Got: %s", data)
         return data['return_value'] == '1'
-- 
GitLab