Skip to content

Commit

Permalink
extra error debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenVdb committed Oct 22, 2024
1 parent e44c9ac commit 72e630e
Show file tree
Hide file tree
Showing 5 changed files with 1,203 additions and 1,209 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"displayName": "Daikin Cloud",
"platformname": "daikincloud",
"name": "homebridge-daikin-cloud",
"version": "2.7.0-beta.3",
"version": "2.7.0-beta.4",
"description": "Integrate with the Daikin Cloud to control your Daikin air conditioning via the cloud",
"license": "Apache-2.0",
"repository": {
Expand Down
27 changes: 14 additions & 13 deletions src/climateControlService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {CharacteristicValue, PlatformAccessory, Service} from 'homebridge';
import {DaikinCloudAccessoryContext, DaikinCloudPlatform} from './platform';
import {DaikinCloudRepo} from "./repository/daikinCloudRepo";

Check warning on line 3 in src/climateControlService.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Strings must use singlequote

Check warning on line 3 in src/climateControlService.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Strings must use singlequote

export class ClimateControlService {
readonly platform: DaikinCloudPlatform;
Expand Down Expand Up @@ -284,7 +285,7 @@ export class ClimateControlService {
try {
await this.accessory.context.device.setData(this.managementPointId, 'onOffMode', state ? DaikinOnOffModes.ON : DaikinOnOffModes.OFF, undefined);
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
this.platform.forceUpdateDevices();
}
Expand All @@ -308,7 +309,7 @@ export class ClimateControlService {
try {
await this.accessory.context.device.setData(this.managementPointId, 'temperatureControl', `/operationModes/cooling/setpoints/${this.getSetpoint()}`, temperature);
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}

this.platform.forceUpdateDevices();
Expand All @@ -327,7 +328,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'fanControl', `/operationModes/${this.getCurrentOperationMode()}/fanSpeed/currentMode`, 'fixed');
await this.accessory.context.device.setData(this.managementPointId, 'fanControl', `/operationModes/${this.getCurrentOperationMode()}/fanSpeed/modes/fixed`, speed);
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}

this.platform.forceUpdateDevices();
Expand All @@ -347,7 +348,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'temperatureControl', `/operationModes/heating/setpoints/${this.getSetpoint()}`, temperature);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand Down Expand Up @@ -391,7 +392,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'onOffMode', DaikinOnOffModes.ON, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -405,7 +406,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'fanControl', `/operationModes/${this.getCurrentOperationMode()}/fanDirection/vertical/currentMode`, daikinSwingMode);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand Down Expand Up @@ -436,7 +437,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'powerfulMode', daikinPowerfulMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -453,7 +454,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'econoMode', daikinEconoMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -470,7 +471,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'streamerMode', daikinStreamerMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -487,7 +488,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'outdoorSilentMode', daikinOutdoorSilentMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -504,7 +505,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'fanControl', `/operationModes/${this.getCurrentOperationMode()}/fanSpeed/currentMode`, daikinFanSpeedMode);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -522,7 +523,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'operationMode', daikinOperationMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand All @@ -539,7 +540,7 @@ export class ClimateControlService {
await this.accessory.context.device.setData(this.managementPointId, 'operationMode', daikinOperationMode, undefined);
this.platform.forceUpdateDevices();
} catch (e) {
this.platform.log.error('Failed to set', e, this.accessory.context.device.desc);
this.platform.log.error('Failed to set', e, JSON.stringify(DaikinCloudRepo.maskSensitiveCloudDeviceData(this.accessory.context.device.desc), null, 4));
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/repository/daikinCloudRepo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class DaikinCloudRepo {
static maskSensitiveCloudDeviceData(cloudDeviceDetails) {
cloudDeviceDetails.map(deviceDetail => {
deviceDetail = deviceDetail.managementPoints.map(managementPoint => {
return {
managementPoints: cloudDeviceDetails.managementPoints.map(managementPoint => {
if (managementPoint.embeddedId === 'gateway') {
if (managementPoint.ipAddress) managementPoint.ipAddress.value = 'REDACTED';
if (managementPoint.macAddress) managementPoint.macAddress.value = 'REDACTED';
Expand All @@ -19,9 +19,8 @@ export class DaikinCloudRepo {
if (managementPoint.consumptionData) managementPoint.consumptionData = 'REDACTED';
}
return managementPoint;
});
return deviceDetail;
});
return cloudDeviceDetails;
}),
...cloudDeviceDetails
};
}
}
Loading

0 comments on commit 72e630e

Please sign in to comment.