refactor(data_coordinators): rename
This commit is contained in:
parent
92bd188ea9
commit
24488a8eb7
@ -26,8 +26,8 @@ from .const import (
|
|||||||
)
|
)
|
||||||
from .nicehash import NiceHashPrivateClient
|
from .nicehash import NiceHashPrivateClient
|
||||||
from .data_coordinators import (
|
from .data_coordinators import (
|
||||||
NiceHashAccountsDataUpdateCoordinator,
|
AccountsDataUpdateCoordinator,
|
||||||
NiceHashMiningRigsDataUpdateCoordinator,
|
MiningRigsDataUpdateCoordinator,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -67,7 +67,7 @@ async def async_setup(hass: HomeAssistant, config: Config):
|
|||||||
|
|
||||||
client = NiceHashPrivateClient(organization_id, api_key, api_secret)
|
client = NiceHashPrivateClient(organization_id, api_key, api_secret)
|
||||||
|
|
||||||
accounts_coordinator = NiceHashAccountsDataUpdateCoordinator(hass, client)
|
accounts_coordinator = AccountsDataUpdateCoordinator(hass, client)
|
||||||
|
|
||||||
await accounts_coordinator.async_refresh()
|
await accounts_coordinator.async_refresh()
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ async def async_setup(hass: HomeAssistant, config: Config):
|
|||||||
hass.data[DOMAIN]["accounts_coordinator"] = accounts_coordinator
|
hass.data[DOMAIN]["accounts_coordinator"] = accounts_coordinator
|
||||||
|
|
||||||
if rigs_enabled or devices_enabled:
|
if rigs_enabled or devices_enabled:
|
||||||
rigs_coordinator = NiceHashMiningRigsDataUpdateCoordinator(hass, client)
|
rigs_coordinator = MiningRigsDataUpdateCoordinator(hass, client)
|
||||||
await rigs_coordinator.async_refresh()
|
await rigs_coordinator.async_refresh()
|
||||||
|
|
||||||
if not rigs_coordinator.last_update_success:
|
if not rigs_coordinator.last_update_success:
|
||||||
|
@ -22,7 +22,7 @@ SCAN_INTERVAL_ACCOUNTS = timedelta(minutes=60)
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class NiceHashAccountsDataUpdateCoordinator(DataUpdateCoordinator):
|
class AccountsDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
"""Manages fetching accounts data from NiceHash API"""
|
"""Manages fetching accounts data from NiceHash API"""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: NiceHashPrivateClient):
|
def __init__(self, hass: HomeAssistant, client: NiceHashPrivateClient):
|
||||||
@ -55,7 +55,7 @@ class NiceHashAccountsDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
raise UpdateFailed(e)
|
raise UpdateFailed(e)
|
||||||
|
|
||||||
|
|
||||||
class NiceHashMiningRigsDataUpdateCoordinator(DataUpdateCoordinator):
|
class MiningRigsDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
"""Manages fetching mining rigs data from NiceHash API"""
|
"""Manages fetching mining rigs data from NiceHash API"""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: NiceHashPrivateClient):
|
def __init__(self, hass: HomeAssistant, client: NiceHashPrivateClient):
|
||||||
|
Loading…
Reference in New Issue
Block a user