Skip to content

Commit

Permalink
Use generic names with nullish assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Sep 3, 2024
1 parent 6213d79 commit 4389ea7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class TeslaFleetApiPlatform implements DynamicPlatformPlugin {
return;
}
this.TeslaFleetApi.vehicle!;
product.display_name ??= "Tesla";
const uuid = this.api.hap.uuid.generate(
`${PLATFORM_NAME}:${product.vin}`,
);
Expand Down Expand Up @@ -98,7 +99,7 @@ export class TeslaFleetApiPlatform implements DynamicPlatformPlugin {

accessory.context.vin = product.vin;
accessory.context.state = product.state;
accessory.displayName = product.display_name ?? "Tesla";
accessory.displayName = product.display_name;

new VehicleAccessory(this, accessory);
});
Expand All @@ -117,6 +118,8 @@ export class TeslaFleetApiPlatform implements DynamicPlatformPlugin {
return;
}
this.TeslaFleetApi.energy!;
product.site_name ??= "Tesla Energy";

const uuid = this.api.hap.uuid.generate(
`${PLATFORM_NAME}:${product.id}`,
);
Expand All @@ -143,7 +146,7 @@ export class TeslaFleetApiPlatform implements DynamicPlatformPlugin {
accessory.context.battery = product.components.battery;
accessory.context.grid = product.components.grid;
accessory.context.solar = product.components.solar;
accessory.displayName = product.site_name ?? "Tesla Energy";
accessory.displayName = product.site_name;

new EnergyAccessory(this, accessory);
});
Expand Down

0 comments on commit 4389ea7

Please sign in to comment.