Skip to content

Commit

Permalink
Update meater.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jan 10, 2024
1 parent f9a4abe commit 5c0cf49
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/device/meater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,28 @@ export class Meater {

// Temperature Sensor Services
(this.internalTemperatureService =
this.accessory.getService(this.hap.Service.TemperatureSensor) || this.accessory.addService(this.hap.Service.TemperatureSensor)), device.id;
this.internalTemperatureService.setCharacteristic(this.hap.Characteristic.Name, `${accessory.displayName} Internal Temperature`);
this.accessory.getService(this.hap.Service.TemperatureSensor) ||
this.accessory.addService(this.hap.Service.TemperatureSensor), `${device.id} Internal`), `${device.id} Internal`;
this.internalTemperatureService.setCharacteristic(this.hap.Characteristic.Name, `${accessory.displayName.slice(0, 5)} Internal Temperature`);
if (
!this.internalTemperatureService.testCharacteristic(this.hap.Characteristic.ConfiguredName) &&
!this.internalTemperatureService.testCharacteristic(this.hap.Characteristic.Name)
) {
this.internalTemperatureService.addCharacteristic(this.hap.Characteristic.ConfiguredName, `${accessory.displayName} Internal Temperature`);
this.internalTemperatureService.addCharacteristic(
this.hap.Characteristic.ConfiguredName, `${accessory.displayName.slice(0, 5)} Internal Temperature`,
);
}

(this.ambientTemperatureService =
this.accessory.getService(this.hap.Service.TemperatureSensor) || this.accessory.addService(this.hap.Service.TemperatureSensor)), device.id;
this.ambientTemperatureService.setCharacteristic(this.hap.Characteristic.Name, `${accessory.displayName} Ambient Temperature`);
this.accessory.getService(this.hap.Service.TemperatureSensor) ||
this.accessory.addService(this.hap.Service.TemperatureSensor), `${device.id} Ambient`), `${device.id} Ambient`;
this.ambientTemperatureService.setCharacteristic(this.hap.Characteristic.Name, `${accessory.displayName.slice(0, 5)} Ambient Temperature`);
if (
!this.ambientTemperatureService.testCharacteristic(this.hap.Characteristic.ConfiguredName) &&
!this.ambientTemperatureService.testCharacteristic(this.hap.Characteristic.Name)
) {
this.ambientTemperatureService.addCharacteristic(this.hap.Characteristic.ConfiguredName, `${accessory.displayName} Ambient Temperature`);
this.ambientTemperatureService.addCharacteristic(
this.hap.Characteristic.ConfiguredName, `${accessory.displayName.slice(0, 5)} Ambient Temperature`);
}

// Retrieve initial values and update Homekit
Expand Down

0 comments on commit 5c0cf49

Please sign in to comment.