mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
switch.tplink: catch exceptions coming from pyHS100 to avoid flooding the logs when the plug is not available (#6400)
This commit is contained in:
parent
c0bf3d7f32
commit
96aae1292b
@ -83,6 +83,7 @@ class SmartPlugSwitch(SwitchDevice):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the TP-Link switch's state."""
|
"""Update the TP-Link switch's state."""
|
||||||
|
from pyHS100 import SmartPlugException
|
||||||
try:
|
try:
|
||||||
self._state = self.smartplug.state == \
|
self._state = self.smartplug.state == \
|
||||||
self.smartplug.SWITCH_STATE_ON
|
self.smartplug.SWITCH_STATE_ON
|
||||||
@ -107,5 +108,5 @@ class SmartPlugSwitch(SwitchDevice):
|
|||||||
# device returned no daily history
|
# device returned no daily history
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except OSError:
|
except (SmartPlugException, OSError) as ex:
|
||||||
_LOGGER.warning('Could not update status for %s', self.name)
|
_LOGGER.warning('Could not read state for %s: %s', self.name, ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user