diff --git a/homeassistant/components/wemo/binary_sensor.py b/homeassistant/components/wemo/binary_sensor.py index b6690ed6d28..2ea5f2d0b07 100644 --- a/homeassistant/components/wemo/binary_sensor.py +++ b/homeassistant/components/wemo/binary_sensor.py @@ -41,7 +41,7 @@ class WemoBinarySensor(WemoSubscriptionEntity, BinarySensorEntity): if not self._available: _LOGGER.info("Reconnected to %s", self.name) self._available = True - except (AttributeError, ActionException) as err: + except ActionException as err: _LOGGER.warning("Could not update status for %s (%s)", self.name, err) self._available = False self.wemo.reconnect_with_device() diff --git a/homeassistant/components/wemo/fan.py b/homeassistant/components/wemo/fan.py index cdbcc89fae6..faf1b50f1cd 100644 --- a/homeassistant/components/wemo/fan.py +++ b/homeassistant/components/wemo/fan.py @@ -155,7 +155,7 @@ class WemoHumidifier(WemoSubscriptionEntity, FanEntity): if not self._available: _LOGGER.info("Reconnected to %s", self.name) self._available = True - except (AttributeError, ActionException) as err: + except ActionException as err: _LOGGER.warning("Could not update status for %s (%s)", self.name, err) self._available = False self.wemo.reconnect_with_device() diff --git a/homeassistant/components/wemo/light.py b/homeassistant/components/wemo/light.py index 1362c7d483c..9aa7c945671 100644 --- a/homeassistant/components/wemo/light.py +++ b/homeassistant/components/wemo/light.py @@ -191,7 +191,7 @@ class WemoLight(WemoEntity, LightEntity): try: self._update_lights(no_throttle=force_update) self._state = self.wemo.state - except (AttributeError, ActionException) as err: + except ActionException as err: _LOGGER.warning("Could not update status for %s (%s)", self.name, err) self._available = False self.wemo.bridge.reconnect_with_device() @@ -238,7 +238,7 @@ class WemoDimmer(WemoSubscriptionEntity, LightEntity): if not self._available: _LOGGER.info("Reconnected to %s", self.name) self._available = True - except (AttributeError, ActionException) as err: + except ActionException as err: _LOGGER.warning("Could not update status for %s (%s)", self.name, err) self._available = False self.wemo.reconnect_with_device() diff --git a/homeassistant/components/wemo/switch.py b/homeassistant/components/wemo/switch.py index 50926e07a11..4d2b9c007d4 100644 --- a/homeassistant/components/wemo/switch.py +++ b/homeassistant/components/wemo/switch.py @@ -177,7 +177,7 @@ class WemoSwitch(WemoSubscriptionEntity, SwitchEntity): if not self._available: _LOGGER.info("Reconnected to %s", self.name) self._available = True - except (AttributeError, ActionException) as err: + except ActionException as err: _LOGGER.warning("Could not update status for %s (%s)", self.name, err) self._available = False self.wemo.reconnect_with_device() diff --git a/tests/components/wemo/entity_test_helpers.py b/tests/components/wemo/entity_test_helpers.py index 0ecfc46d526..87bc6fd7f40 100644 --- a/tests/components/wemo/entity_test_helpers.py +++ b/tests/components/wemo/entity_test_helpers.py @@ -6,6 +6,8 @@ import asyncio import threading from unittest.mock import patch +from pywemo.ouimeaux_device.api.service import ActionException + from homeassistant.components.homeassistant import ( DOMAIN as HA_DOMAIN, SERVICE_UPDATE_ENTITY, @@ -127,7 +129,7 @@ async def test_async_locked_update_with_exception( assert hass.states.get(wemo_entity.entity_id).state == STATE_OFF await async_setup_component(hass, HA_DOMAIN, {}) update_polling_method = update_polling_method or pywemo_device.get_state - update_polling_method.side_effect = AttributeError + update_polling_method.side_effect = ActionException await hass.services.async_call( HA_DOMAIN,