Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Jun 7, 2024
1 parent f442326 commit 244eb81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions custom_components/teslemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
elif "energy_site_id" in product and Scope.ENERGY_DEVICE_DATA in scopes:
site_id = product["energy_site_id"]
api = EnergySpecific(teslemetry.energy, site_id)
live_coordinator = TeslemetryEnergySiteLiveCoordinator(hass, api, entry.entry_id)
info_coordinator = TeslemetryEnergySiteInfoCoordinator(hass, api, entry.entry_id, product)
live_coordinator = TeslemetryEnergySiteLiveCoordinator(hass, api)
info_coordinator = TeslemetryEnergySiteInfoCoordinator(hass, api, product)

device = DeviceInfo(
identifiers={(DOMAIN, str(site_id))},
Expand Down
8 changes: 2 additions & 6 deletions custom_components/teslemetry/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async def _async_update_data(self) -> dict[str, Any]:
class TeslemetryEnergySiteLiveCoordinator(DataUpdateCoordinator[dict[str, Any]]):
"""Class to manage fetching energy site live status from the Teslemetry API."""

def __init__(self, hass: HomeAssistant, api: EnergySpecific, uid: str, ) -> None:
def __init__(self, hass: HomeAssistant, api: EnergySpecific) -> None:
"""Initialize Teslemetry Energy Site Live coordinator."""
super().__init__(
hass,
Expand All @@ -147,8 +147,6 @@ async def _async_update_data(self) -> dict[str, Any]:
data = (await self.api.live_status())["response"]
except InvalidToken as e:
raise ConfigEntryAuthFailed from e
except SubscriptionRequired as e:
raise ConfigEntryAuthFailed from e
except TeslaFleetError as e:
raise UpdateFailed(e.message) from e
except TypeError as e:
Expand All @@ -167,7 +165,7 @@ async def _async_update_data(self) -> dict[str, Any]:
class TeslemetryEnergySiteInfoCoordinator(DataUpdateCoordinator[dict[str, Any]]):
"""Class to manage fetching energy site info from the Teslemetry API."""

def __init__(self, hass: HomeAssistant, api: EnergySpecific, uid: str, product: dict) -> None:
def __init__(self, hass: HomeAssistant, api: EnergySpecific, product: dict) -> None:
"""Initialize Teslemetry Energy Info coordinator."""
super().__init__(
hass,
Expand All @@ -186,8 +184,6 @@ async def _async_update_data(self) -> dict[str, Any]:
data = (await self.api.site_info())["response"]
except InvalidToken as e:
raise ConfigEntryAuthFailed from e
except SubscriptionRequired as e:
raise ConfigEntryAuthFailed from e
except TeslaFleetError as e:
raise UpdateFailed(e.message) from e
except TypeError as e:
Expand Down

0 comments on commit 244eb81

Please sign in to comment.