mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +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):
|
||||
"""Update the TP-Link switch's state."""
|
||||
from pyHS100 import SmartPlugException
|
||||
try:
|
||||
self._state = self.smartplug.state == \
|
||||
self.smartplug.SWITCH_STATE_ON
|
||||
@ -107,5 +108,5 @@ class SmartPlugSwitch(SwitchDevice):
|
||||
# device returned no daily history
|
||||
pass
|
||||
|
||||
except OSError:
|
||||
_LOGGER.warning('Could not update status for %s', self.name)
|
||||
except (SmartPlugException, OSError) as ex:
|
||||
_LOGGER.warning('Could not read state for %s: %s', self.name, ex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user