Add re-auth flow to glances integration (#100929)
* Add reauth flow to glances integration. * add reauth string * add reauth strings
This commit is contained in:
parent
c823e407fd
commit
785b46af22
5 changed files with 155 additions and 7 deletions
|
@ -7,6 +7,7 @@ from glances_api import Glances, exceptions
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
|
||||
|
@ -36,6 +37,8 @@ class GlancesDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||
"""Get the latest data from the Glances REST API."""
|
||||
try:
|
||||
data = await self.api.get_ha_sensor_data()
|
||||
except exceptions.GlancesApiAuthorizationError as err:
|
||||
raise ConfigEntryAuthFailed from err
|
||||
except exceptions.GlancesApiError as err:
|
||||
raise UpdateFailed from err
|
||||
return data or {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue