mirror of
https://github.com/home-assistant/core.git
synced 2025-05-17 20:39:16 +00:00
Fix connection check (#4732)
* Fix connection check * Release instead * Remove if * Update hook.py
This commit is contained in:
parent
8ca2345fd4
commit
a11b68c560
@ -50,7 +50,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
if response is not None:
|
if response is not None:
|
||||||
yield from response.close()
|
yield from response.release()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
token = data['data']['token']
|
token = data['data']['token']
|
||||||
@ -72,7 +72,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
if response is not None:
|
if response is not None:
|
||||||
yield from response.close()
|
yield from response.release()
|
||||||
|
|
||||||
yield from async_add_devices(
|
yield from async_add_devices(
|
||||||
HookSmartHome(
|
HookSmartHome(
|
||||||
@ -127,7 +127,7 @@ class HookSmartHome(SwitchDevice):
|
|||||||
|
|
||||||
finally:
|
finally:
|
||||||
if response is not None:
|
if response is not None:
|
||||||
yield from response.close()
|
yield from response.release()
|
||||||
|
|
||||||
_LOGGER.debug("Got: %s", data)
|
_LOGGER.debug("Got: %s", data)
|
||||||
return data['return_value'] == '1'
|
return data['return_value'] == '1'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user