Skip to content

Commit

Permalink
Improved Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
littleyoda committed Oct 7, 2024
1 parent f1c3e81 commit 433ca06
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/pysmaplus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_update_data():
"""Update the used SMA sensors."""
try:
_LOGGER.info(f"Update pysma {entry.data[CONF_HOST]}/{entry.data[CONF_ACCESS]}/{entry.data[CONF_DEVICE]}")
await sma.read(sensor_def, entry.data[CONF_DEVICE])
except (
pysma.exceptions.SmaReadException,
pysma.exceptions.SmaConnectionException,
TimeoutError
) as exc:
_LOGGER.warning(f"Update Failed {type(exc)} {entry.data[CONF_HOST]}/{entry.data[CONF_ACCESS]}/{entry.data[CONF_DEVICE]}")
_LOGGER.warning(exc, exc_info=True)
raise UpdateFailed(exc) from exc
except Exception as e:
_LOGGER.warning(f"Update Failed. Unfetched Exception {type(e)} {entry.data[CONF_HOST]}/{entry.data[CONF_ACCESS]}/{entry.data[CONF_DEVICE]}")



interval = timedelta(
seconds=entry.options.get(CONF_SCAN_INTERVAL, entry.data[CONF_SCAN_INTERVAL])
Expand Down

0 comments on commit 433ca06

Please sign in to comment.