Skip to content

Commit

Permalink
Add prefixName config
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Jun 19, 2024
1 parent 1a2be59 commit e04901d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"properties": {
"name": {
"title": "Name",
"description": "A unique name for the platform",
"type": "string",
"required": true,
"default": "Teslemetry"
Expand All @@ -16,6 +17,13 @@
"title": "Access Token",
"type": "string",
"required": true
},
"prefixName": {
"title": "Prefix Name",
"description": "Prefix the name of each service with the name of the vehicle",
"type": "boolean",
"required": false,
"default": true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vehicle-services/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export abstract class BaseService {
this.emitter = parent.emitter;
this.vehicle = parent.vehicle;

name = `${this.parent.accessory.displayName} ${name}`;
name = parent.platform.config.prefixName ? `${this.parent.accessory.displayName} ${name}` : name;

if (this.accessory.getServiceById(definition, subtype)) {
this.log.info(`Restoring service ${name}`);
Expand Down

0 comments on commit e04901d

Please sign in to comment.