mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Not need to raise exception
This commit is contained in:
parent
e45ef0013b
commit
1bebb17e9f
@ -72,9 +72,6 @@ class MyStromSwitch(SwitchDevice):
|
|||||||
timeout=10)
|
timeout=10)
|
||||||
if request.status_code == 200:
|
if request.status_code == 200:
|
||||||
self._state = True
|
self._state = True
|
||||||
else:
|
|
||||||
raise requests.exceptions.ConnectionError
|
|
||||||
|
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
_LOGGER.error("Can't turn on %s. Is device offline?",
|
_LOGGER.error("Can't turn on %s. Is device offline?",
|
||||||
self._resource)
|
self._resource)
|
||||||
@ -87,9 +84,6 @@ class MyStromSwitch(SwitchDevice):
|
|||||||
timeout=10)
|
timeout=10)
|
||||||
if request.status_code == 200:
|
if request.status_code == 200:
|
||||||
self._state = False
|
self._state = False
|
||||||
else:
|
|
||||||
raise requests.exceptions.ConnectionError
|
|
||||||
|
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
_LOGGER.error("Can't turn on %s. Is device offline?",
|
_LOGGER.error("Can't turn on %s. Is device offline?",
|
||||||
self._resource)
|
self._resource)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user