Skip to content

Commit

Permalink
Give the coordinator product data
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Jan 31, 2024
1 parent 9d04aa6 commit cee3b44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/teslemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if "vin" in product:
vin = product["vin"]
api = VehicleSpecific(teslemetry.vehicle, vin)
coordinator = TeslemetryVehicleDataCoordinator(hass, api)
coordinator = TeslemetryVehicleDataCoordinator(hass, api, product)
vehicles.append(
TeslemetryVehicleData(
api=api,
Expand Down
4 changes: 2 additions & 2 deletions custom_components/teslemetry/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TeslemetryVehicleDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):



def __init__(self, hass: HomeAssistant, api: VehicleSpecific) -> None:
def __init__(self, hass: HomeAssistant, api: VehicleSpecific, product: dict) -> None:
"""Initialize Teslemetry Vehicle Update Coordinator."""
super().__init__(
hass,
Expand All @@ -28,7 +28,7 @@ def __init__(self, hass: HomeAssistant, api: VehicleSpecific) -> None:
update_interval=timedelta(seconds=SYNC_INTERVAL),
)
self.api = api
self.data = {"state": None}
self.data = product

async def _async_update_data(self) -> dict[str, Any]:
"""Update vehicle data using Teslemetry API."""
Expand Down

0 comments on commit cee3b44

Please sign in to comment.