From e04901dafa656ee26694e3659fed96b90a354a8b Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 20 Jun 2024 08:04:47 +1000 Subject: [PATCH] Add prefixName config --- config.schema.json | 8 ++++++++ src/vehicle-services/base.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config.schema.json b/config.schema.json index d8999de..cfcff58 100644 --- a/config.schema.json +++ b/config.schema.json @@ -8,6 +8,7 @@ "properties": { "name": { "title": "Name", + "description": "A unique name for the platform", "type": "string", "required": true, "default": "Teslemetry" @@ -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 } } } diff --git a/src/vehicle-services/base.ts b/src/vehicle-services/base.ts index cff12ef..6eae2be 100644 --- a/src/vehicle-services/base.ts +++ b/src/vehicle-services/base.ts @@ -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}`);