Skip to content

Commit

Permalink
Removed update_method
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdelprete committed Feb 5, 2024
1 parent 3ef3805 commit 861ebca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions custom_components/abb_powerone_pvi_sunspec/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,9 @@ async def async_get_data(self):
)
# HA proper way to call a sync function from async function
# https://developers.home-assistant.io/docs/asyncio_working_with_async?#calling-sync-functions-from-async
# result = await self._hass.async_add_executor_job(
# self.read_sunspec_modbus
# )
result = self.read_sunspec_modbus()
result = await self._hass.async_add_executor_job(
self.read_sunspec_modbus
)
self.close()
_LOGGER.debug("End Get data")
if result:
Expand Down
6 changes: 4 additions & 2 deletions custom_components/abb_powerone_pvi_sunspec/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
class HubDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching data from the API."""

config_entry: ConfigEntry

def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Initialize data update coordinator."""
# get scan_interval from user config
Expand All @@ -48,7 +50,7 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
hass,
_LOGGER,
name=f"{DOMAIN} ({config_entry.unique_id})",
update_method=self.async_update_data,
# update_method=self.async_update_data,
update_interval=self.update_interval,
)

Expand Down Expand Up @@ -83,7 +85,7 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
)

async def async_update_data(self):
"""Update data via library."""
"""Update data method."""
_LOGGER.debug("ABB SunSpec Update data coordinator update")
try:
await self.api.async_get_data()
Expand Down

0 comments on commit 861ebca

Please sign in to comment.