From ab36ac7a94890b7bf8b7ab2811c0ad89f1a814d8 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Tue, 20 Jul 2021 00:20:47 -0700 Subject: [PATCH] Handle all WeMo ensure_long_press_virtual_device exceptions (#53094) * Handle all exceptions around the WeMo ensure_long_press_virtual_device method * Don't use a bare exception Co-authored-by: Martin Hjelmare * Log exception Co-authored-by: Martin Hjelmare --- homeassistant/components/wemo/wemo_device.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/wemo/wemo_device.py b/homeassistant/components/wemo/wemo_device.py index 3b0fbdcbe55..6fd1f4d5512 100644 --- a/homeassistant/components/wemo/wemo_device.py +++ b/homeassistant/components/wemo/wemo_device.py @@ -1,7 +1,7 @@ """Home Assistant wrapper for a pyWeMo device.""" import logging -from pywemo import PyWeMoException, WeMoDevice +from pywemo import WeMoDevice from pywemo.subscribe import EVENT_TYPE_LONG_PRESS from homeassistant.config_entries import ConfigEntry @@ -81,8 +81,10 @@ async def async_register_device( if device.supports_long_press: try: await hass.async_add_executor_job(wemo.ensure_long_press_virtual_device) - except PyWeMoException: - _LOGGER.warning( + # Temporarily handling all exceptions for #52996 & pywemo/pywemo/issues/276 + # Replace this with `except: PyWeMoException` after upstream has been fixed. + except Exception: # pylint: disable=broad-except + _LOGGER.exception( "Failed to enable long press support for device: %s", wemo.name ) device.supports_long_press = False