Skip to content

Commit

Permalink
platform config
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Nov 1, 2024
1 parent 8e7f036 commit 952945c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/devices/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@ export abstract class deviceBase {
}

async getDeviceLogSettings(accessory: PlatformAccessory, device: resideoDevice & devicesConfig): Promise<void> {
this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.config.logging ?? 'standard'
const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.config.logging ? 'Platform Config' : 'Default'
this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.platform.platformLogging ?? 'standard'
const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.platform.platformLogging ? 'Platform Config' : 'Default'
accessory.context.deviceLogging = this.deviceLogging
await this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`)
}

async getDeviceRateSettings(accessory: PlatformAccessory, device: resideoDevice & devicesConfig): Promise<void> {
// refreshRate
this.deviceRefreshRate = device.thermostat?.roomsensor?.refreshRate ?? device.thermostat?.roompriority?.refreshRate ?? device.refreshRate ?? this.config.options?.refreshRate ?? 120
this.deviceRefreshRate = device.thermostat?.roomsensor?.refreshRate ?? device.thermostat?.roompriority?.refreshRate ?? device.refreshRate ?? this.platform.platformRefreshRate ?? 120
const refreshRate = device.thermostat?.roomsensor?.refreshRate
? 'Room Sensor Config'
: device.thermostat?.roompriority?.refreshRate
? 'Room Priority Config'
: device.refreshRate
? 'Device Config'
: this.config.options?.refreshRate ? 'Platform Config' : 'Default'
: this.platform.platformRefreshRate ? 'Platform Config' : 'Default'
accessory.context.deviceRefreshRate = this.deviceRefreshRate
// pushRate
this.devicePushRate = device.pushRate ?? this.config.options?.pushRate ?? 0.1
const pushRate = device.pushRate ? 'Device Config' : this.config.options?.pushRate ? 'Platform Config' : 'Default'
this.devicePushRate = device.pushRate ?? this.platform.platformPushRate ?? 0.1
const pushRate = device.pushRate ? 'Device Config' : this.platform.platformPushRate ? 'Platform Config' : 'Default'
await this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${pushRate} pushRate: ${this.devicePushRate}`)
accessory.context.devicePushRate = this.devicePushRate
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/leaksensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class LeakSensor extends deviceBase {
this.updateHomeKitCharacteristics()

// Start an update interval
interval(this.config.options!.refreshRate! * 1000)
interval(this.deviceRefreshRate * 1000)
.pipe(skipWhile(() => this.SensorUpdateInProgress))
.subscribe(async () => {
await this.refreshStatus()
Expand Down
2 changes: 1 addition & 1 deletion src/devices/roomsensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class RoomSensors extends deviceBase {
this.updateHomeKitCharacteristics()

// Start an update interval
interval(this.config.options!.refreshRate! * 1000)
interval(this.deviceRefreshRate * 1000)
.pipe(skipWhile(() => this.SensorUpdateInProgress))
.subscribe(async () => {
await this.refreshStatus()
Expand Down
2 changes: 1 addition & 1 deletion src/devices/roomsensorthermostats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class RoomSensorThermostat extends deviceBase {
this.updateHomeKitCharacteristics()

// Start an update interval
interval(this.config.options!.refreshRate! * 1000)
interval(this.deviceRefreshRate * 1000)
.pipe(skipWhile(() => this.thermostatUpdateInProgress))
.subscribe(async () => {
await this.refreshStatus()
Expand Down
2 changes: 1 addition & 1 deletion src/devices/thermostats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class Thermostats extends deviceBase {
this.refreshStatus()

// Start an update interval
interval(this.config.options!.refreshRate! * 1000)
interval(this.deviceRefreshRate * 1000)
.pipe(skipWhile(() => this.thermostatUpdateInProgress))
.subscribe(async () => {
await this.refreshStatus()
Expand Down
1 change: 1 addition & 0 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class ResideoPlatform implements DynamicPlatformPlugin {

this.config = {
platform: 'Resideo',
name: config.name,
credentials: config.credentials,
options: config.options,
}
Expand Down

0 comments on commit 952945c

Please sign in to comment.