mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Update nuheat exception handling (#42127)
* Update nuheat exception handling * remove unneeded exception handler
This commit is contained in:
parent
199464f084
commit
023268df38
@ -18,7 +18,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
from .const import CONF_SERIAL_NUMBER, DOMAIN, PLATFORMS
|
from .const import CONF_SERIAL_NUMBER, DOMAIN, PLATFORMS
|
||||||
|
|
||||||
@ -107,10 +107,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|||||||
|
|
||||||
async def _async_update_data():
|
async def _async_update_data():
|
||||||
"""Fetch data from API endpoint."""
|
"""Fetch data from API endpoint."""
|
||||||
try:
|
await hass.async_add_executor_job(thermostat.get_data)
|
||||||
await hass.async_add_executor_job(thermostat.get_data)
|
|
||||||
except Exception as err:
|
|
||||||
raise UpdateFailed(f"Error communicating with API: {err}") from err
|
|
||||||
|
|
||||||
coordinator = DataUpdateCoordinator(
|
coordinator = DataUpdateCoordinator(
|
||||||
hass,
|
hass,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user