Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions homeassistant/components/light/tplink.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def update(self):
"""Update the TP-Link Bulb's state."""
from pyHS100 import SmartDeviceException
try:
self._available = True

if self._supported_features == 0:
self.get_features()

Expand Down Expand Up @@ -182,9 +180,13 @@ def update(self):
# device returned no daily/monthly history
pass

self._available = True

except (SmartDeviceException, OSError) as ex:
_LOGGER.warning("Could not read state for %s: %s", self._name, ex)
self._available = False
if self._available:
_LOGGER.warning(
"Could not read state for %s: %s", self._name, ex)
self._available = False

@property
def supported_features(self):
Expand Down
10 changes: 6 additions & 4 deletions homeassistant/components/switch/tplink.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ def update(self):
"""Update the TP-Link switch's state."""
from pyHS100 import SmartDeviceException
try:
self._available = True

self._state = self.smartplug.state == \
self.smartplug.SWITCH_STATE_ON

Expand Down Expand Up @@ -121,6 +119,10 @@ def update(self):
# Device returned no daily history
pass

self._available = True

except (SmartDeviceException, OSError) as ex:
_LOGGER.warning("Could not read state for %s: %s", self.name, ex)
self._available = False
if self._available:
_LOGGER.warning(
"Could not read state for %s: %s", self.name, ex)
self._available = False