mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
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 <marhje52@gmail.com> * Log exception Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
e453871c68
commit
ab36ac7a94
@ -1,7 +1,7 @@
|
|||||||
"""Home Assistant wrapper for a pyWeMo device."""
|
"""Home Assistant wrapper for a pyWeMo device."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pywemo import PyWeMoException, WeMoDevice
|
from pywemo import WeMoDevice
|
||||||
from pywemo.subscribe import EVENT_TYPE_LONG_PRESS
|
from pywemo.subscribe import EVENT_TYPE_LONG_PRESS
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -81,8 +81,10 @@ async def async_register_device(
|
|||||||
if device.supports_long_press:
|
if device.supports_long_press:
|
||||||
try:
|
try:
|
||||||
await hass.async_add_executor_job(wemo.ensure_long_press_virtual_device)
|
await hass.async_add_executor_job(wemo.ensure_long_press_virtual_device)
|
||||||
except PyWeMoException:
|
# Temporarily handling all exceptions for #52996 & pywemo/pywemo/issues/276
|
||||||
_LOGGER.warning(
|
# 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
|
"Failed to enable long press support for device: %s", wemo.name
|
||||||
)
|
)
|
||||||
device.supports_long_press = False
|
device.supports_long_press = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user