Skip to content

Commit

Permalink
v2.1.3 (#833)
Browse files Browse the repository at this point in the history
## [2.1.3](https://github.com/donavanbecker/homebridge-resideo/releases/tag/v2.1.3) (2024-07-06)

### What's Changes
- Housekeeping and updated dependencies.

**Full Changelog**: https://github.com/donavanbecker/homebridge-resideo/compare/v2.1.2..v2.1.3
  • Loading branch information
donavanbecker authored Jul 7, 2024
1 parent e11b6fe commit 6036467
Show file tree
Hide file tree
Showing 9 changed files with 584 additions and 527 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)

## [2.1.3](https://github.com/donavanbecker/homebridge-resideo/releases/tag/v2.1.3) (2024-07-06)

### What's Changes
- Housekeeping and updated dependencies.

**Full Changelog**: https://github.com/donavanbecker/homebridge-resideo/compare/v2.1.2..v2.1.3

## [2.1.2](https://github.com/donavanbecker/homebridge-resideo/releases/tag/v2.1.2) (2024-05-30)

### What's Changes
Expand Down
708 changes: 387 additions & 321 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Resideo",
"name": "homebridge-resideo",
"version": "2.1.2",
"version": "2.1.3",
"description": "The Resideo plugin allows you to access your Resideo device(s) from HomeKit.",
"author": {
"name": "donavanbecker",
Expand All @@ -18,7 +18,7 @@
"url": "https://github.com/donavanbecker/homebridge-resideo/issues"
},
"engines": {
"homebridge": "^1.8.2",
"homebridge": "^1.8.3",
"node": "^18 || ^20 || ^22"
},
"main": "dist/index.js",
Expand Down Expand Up @@ -64,23 +64,23 @@
"dependencies": {
"@homebridge/plugin-ui-utils": "^1.0.3",
"rxjs": "^7.8.1",
"undici": "^6.18.2",
"undici": "^6.19.2",
"axios": "1.7.2"
},
"devDependencies": {
"@eslint/js": "^9.3.0",
"@stylistic/eslint-plugin": "^2.1.0",
"@eslint/js": "^9.6.0",
"@stylistic/eslint-plugin": "^2.3.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.12.13",
"eslint": "^9.3.0",
"globals": "^15.3.0",
"homebridge": "^1.8.2",
"homebridge-config-ui-x": "4.56.2",
"nodemon": "^3.1.2",
"@types/node": "^20.14.10",
"eslint": "^9.6.0",
"globals": "^15.8.0",
"homebridge": "^1.8.3",
"homebridge-config-ui-x": "4.56.4",
"nodemon": "^3.1.4",
"npm-check-updates": "^16.14.20",
"rimraf": "^5.0.7",
"rimraf": "^5.0.8",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.0-alpha.24"
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.0-alpha.39"
}
}
140 changes: 46 additions & 94 deletions src/devices/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export abstract class deviceBase {
this.hap = this.api.hap;


this.getDeviceLogSettings(device);
this.getDeviceRateSettings(device);
this.getDeviceLogSettings(accessory, device);
this.getDeviceRateSettings(accessory, device);
this.getDeviceRetry(device);
this.getDeviceConfigSettings(device);
this.getDeviceContext(accessory, device, sensorAccessory);
Expand All @@ -49,53 +49,26 @@ export abstract class deviceBase {
.setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceID);
}

async getDeviceLogSettings(device: resideoDevice & devicesConfig): Promise<void> {
if (this.platform.debugMode) {
this.deviceLogging = this.accessory.context.logging = 'debugMode';
this.debugWarnLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
} else if (device.logging) {
this.deviceLogging = this.accessory.context.logging = device.logging;
this.debugWarnLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
} else if (this.config.options?.logging) {
this.deviceLogging = this.accessory.context.logging = this.config.logging;
this.debugWarnLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
} else {
this.deviceLogging = this.accessory.context.logging = 'standard';
this.debugWarnLog(`${this.device.deviceClass}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
}
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';
accessory.context.deviceLogging = this.deviceLogging;
await this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`);
}

async getDeviceRateSettings(device: resideoDevice & devicesConfig): Promise<void> {
async getDeviceRateSettings(accessory: PlatformAccessory, device: resideoDevice & devicesConfig): Promise<void> {
// refreshRate
if (device.thermostat?.roomsensor?.refreshRate) {
this.deviceRefreshRate = device.thermostat.roomsensor.refreshRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Room Sensor Config Refresh Rate: ${this.deviceRefreshRate}`);
} else if (device.thermostat?.roompriority?.refreshRate) {
this.deviceRefreshRate = device.thermostat.roompriority.refreshRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Room Priority Config Refresh Rate: ${this.deviceRefreshRate}`);
} else if (device.refreshRate) {
this.deviceRefreshRate = this.accessory.context.deviceRefreshRate = device.refreshRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Device Config Refresh Rate: ${this.deviceRefreshRate}`);
} else {
this.deviceRefreshRate = this.config.options?.refreshRate ?? 120;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Platform Config Refresh Rate: ${this.deviceRefreshRate}`);
}
this.accessory.context.deviceRefreshRate = this.deviceRefreshRate;
this.deviceRefreshRate = device.thermostat?.roomsensor?.refreshRate ?? device.thermostat?.roompriority?.refreshRate ?? device.refreshRate
?? this.config.options?.refreshRate ?? 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';
accessory.context.deviceRefreshRate = this.deviceRefreshRate;
// pushRate
if (device.thermostat?.roomsensor?.pushRate) {
this.devicePushRate = device.thermostat.roomsensor.pushRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Room Sensor Config Push Rate: ${this.devicePushRate}`);
} else if (device.thermostat?.roompriority?.pushRate) {
this.devicePushRate = device.thermostat.roompriority.pushRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Room Priority Config Push Rate: ${this.devicePushRate}`);
} else if (device.pushRate) {
this.devicePushRate = device.pushRate;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Device Config Push Rate: ${this.devicePushRate}`);
} else {
this.devicePushRate = this.config.options?.pushRate ?? 0.1;
this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Using Platform Push Rate: ${this.devicePushRate}`);
}
this.accessory.context.devicePushRate = this.devicePushRate;
this.devicePushRate = device.pushRate ?? this.config.options?.pushRate ?? 0.1;
const pushRate = device.pushRate ? 'Device Config' : this.config.options?.pushRate ? 'Platform Config' : 'Default';
await this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${pushRate} pushRate: ${this.devicePushRate}`);
accessory.context.devicePushRate = this.devicePushRate;
}

async getDeviceRetry(device: resideoDevice & devicesConfig): Promise<void> {
Expand Down Expand Up @@ -172,29 +145,8 @@ export abstract class deviceBase {
}

// Firmware Version
let deviceFirmwareVersion: string;
if (sensorAccessory?.accessoryAttribute.softwareRevision) {
deviceFirmwareVersion = sensorAccessory.accessoryAttribute.softwareRevision;
} else if (device.firmware) {
deviceFirmwareVersion = device.firmware;
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 1 FirmwareRevision: ${device.firmware}`);
} else if (device.firmwareVersion) {
deviceFirmwareVersion = device.firmwareVersion;
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 2 FirmwareRevision: ${device.firmwareVersion}`);
} else if (device.thermostatVersion) {
deviceFirmwareVersion = device.thermostatVersion;
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 3 FirmwareRevision: ${device.thermostatVersion}`);
} else if (accessory.context.deviceVersion) {
deviceFirmwareVersion = accessory.context.deviceVersion;
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 4 FirmwareRevision: ${accessory.context.deviceVersion}`);
} else {
deviceFirmwareVersion = this.platform.version ?? '0.0.0';
if (this.platform.version) {
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 5 FirmwareRevision: ${this.platform.version}`);
} else {
this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} 6 FirmwareRevision: ${deviceFirmwareVersion}`);
}
}
const deviceFirmwareVersion = sensorAccessory?.accessoryAttribute.softwareRevision ?? device.firmware ?? device.firmwareVersion
?? device.thermostatVersion ?? accessory.context.version ?? this.platform.version ?? '0.0.0';
const version = deviceFirmwareVersion.toString();
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Firmware Version: ${version?.replace(/^V|-.*$/g, '')}`);
let deviceVersion: string;
Expand Down Expand Up @@ -290,65 +242,65 @@ export abstract class deviceBase {
/**
* Logging for Device
*/
infoLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
this.log.info(String(...log));
async infoLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.info(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}

successLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
this.log.success(String(...log));
async successLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.success(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}

debugSuccessLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
async debugSuccessLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.success('[DEBUG]', String(...log));
this.log.success(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}
}

warnLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
this.log.warn(String(...log));
async warnLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.warn(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}

debugWarnLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
async debugWarnLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.warn('[DEBUG]', String(...log));
this.log.warn(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}
}

errorLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
this.log.error(String(...log));
async errorLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
this.log.error(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}

debugErrorLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
async debugErrorLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging?.includes('debug')) {
this.log.error('[DEBUG]', String(...log));
this.log.error(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}
}

debugLog(...log: any[]): void {
if (this.enablingDeviceLogging()) {
async debugLog(...log: any[]): Promise<void> {
if (await this.enablingDeviceLogging()) {
if (this.deviceLogging === 'debug') {
this.log.info('[DEBUG]', String(...log));
this.log.info(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
} else {
this.log.debug(String(...log));
this.log.debug(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
}
}
}

enablingDeviceLogging(): boolean {
async enablingDeviceLogging(): Promise<boolean> {
return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
}
}
14 changes: 7 additions & 7 deletions src/devices/leaksensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ export class LeakSensor extends deviceBase {
// Initialize Leak Sensor Service
if (device.leaksensor?.hide_leak) {
if (this.LeakSensor) {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Removing Leak Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Leak Sensor Service`);
this.LeakSensor.Service = accessory.getService(this.hap.Service.LeakSensor) as Service;
accessory.removeService(this.LeakSensor.Service);
} else {
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Leak Sensor Service Not Found`);
}
} else {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Add Leak Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Leak Sensor Service`);
accessory.context.LeakSensor = accessory.context.LeakSensor ?? {};
this.LeakSensor = {
Name: accessory.context.LeakSensor.Name ?? `${accessory.displayName} Leak Sensor`,
Expand Down Expand Up @@ -119,14 +119,14 @@ export class LeakSensor extends deviceBase {
// Initialize Temperature Sensor Service
if (device.leaksensor?.hide_temperature) {
if (this.TemperatureSensor) {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Removing Temperature Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Temperature Sensor Service`);
this.TemperatureSensor.Service = accessory.getService(this.hap.Service.TemperatureSensor) as Service;
accessory.removeService(this.TemperatureSensor.Service);
} else {
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Temperature Sensor Service Not Found`);
}
} else {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Add Temperature Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Temperature Sensor Service`);
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
this.TemperatureSensor = {
Name: accessory.context.TemperatureSensor.Name ?? `${accessory.displayName} Temperature Sensor`,
Expand All @@ -153,14 +153,14 @@ export class LeakSensor extends deviceBase {
// Initialize Humidity Sensor Service
if (device.leaksensor?.hide_humidity) {
if (this.HumiditySensor) {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Removing Humidity Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Humidity Sensor Service`);
this.HumiditySensor.Service = accessory.getService(this.hap.Service.HumiditySensor) as Service;
accessory.removeService(this.HumiditySensor.Service);
} else {
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Humidity Sensor Service Not Found`);
}
} else if (device.indoorHumidity) {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Add Humidity Sensor Service`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Humidity Sensor Service`);
accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
this.HumiditySensor = {
Name: accessory.context.HumiditySensor.Name ?? `${accessory.displayName} Humidity Sensor`,
Expand All @@ -183,7 +183,7 @@ export class LeakSensor extends deviceBase {
});

} else {
this.debugLog(`${device.deviceClass}: ${accessory.displayName} Humidity Sensor Service Not Added`);
this.debugLog(`${device.deviceClass} ${accessory.displayName} Humidity Sensor Service Not Added`);
}

// Intial Refresh
Expand Down
Loading

0 comments on commit 6036467

Please sign in to comment.