mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove exception handling for AttributeError in wemo (#46674)
This commit is contained in:
parent
8c72cb6163
commit
94131df5e0
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user