Skip to content

Commit

Permalink
fix: imrpoved debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper-seinhorst committed Mar 29, 2023
1 parent 8bb652d commit daaa4e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Accessories/Charger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export default class Charger implements PorscheAccessory {

// Is battery low state
const isLowBatteryLevel = (newBatteryLevel <= this.lowBatteryLevel);
if (isLowBatteryLevel !== this.batteryService.getCharacteristic(this.Characteristic.StatusLowBattery).value) {
if (isLowBatteryLevel !== (this.batteryService.getCharacteristic(this.Characteristic.StatusLowBattery).value === 1)) {
this.log.debug('Low battery level state ->', isLowBatteryLevel);
}
this.batteryService.setCharacteristic(this.Characteristic.StatusLowBattery, isLowBatteryLevel);

// Charging state
const isCharging = emobilityInfo.batteryChargeStatus.chargingState === 'CHARGING';
if (isCharging !== this.batteryService.getCharacteristic(this.Characteristic.ChargingState).value) {
if (isCharging !== (this.batteryService.getCharacteristic(this.Characteristic.ChargingState).value === 1)) {
this.log.debug('Charging state ->', isCharging);
}
this.chargerService.setCharacteristic(this.sensorType === 'occupancy' ? this.Characteristic.OccupancyDetected : this.Characteristic.ContactSensorState, isCharging);
Expand Down
4 changes: 2 additions & 2 deletions src/Accessories/DirectCharge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export default class DirectCharge implements PorscheAccessory {
// Only call API when status is not changed during heartbeat
if (this.vehicle && !this.heartBeatActive) {
if (value) {
this.log.debug('Connecting with API to enableDirectCharge');
this.log.debug('Connecting with API to enable Direct Charge');
this.vehicle.enableDirectCharge();
} else {
this.log.debug('Connecting with API to disableDirectCharge');
this.log.debug('Connecting with API to disable Direct Charge');
this.vehicle.disableDirectCharge();
}
return callback();
Expand Down
8 changes: 4 additions & 4 deletions src/Accessories/DirectClimatisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default class DirectClimatisation implements PorscheAccessory {
// Only call API when status is not changed during heartbeat
if (this.vehicle && !this.heartBeatActive) {
if (value) {
this.log.debug('Connecting with API to enableClimate');
this.vehicle.enableClimate();
this.log.debug('Connecting with API to enable Direct Climatisation');
this.vehicle.enableDirectClimate();
} else {
this.log.debug('Connecting with API to disableClimate');
this.vehicle.disableClimate();
this.log.debug('Connecting with API to disable Direct Climatisation');
this.vehicle.disableDirectClimate();
}
return callback();
}
Expand Down
4 changes: 2 additions & 2 deletions src/porsche-connect/Vehicle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export class Vehicle {
await this.porscheConnect.disableVehicleDirectCharge(this.vin, this.carModel);
}

public async enableClimate() {
public async enableDirectClimate() {
await this.porscheConnect.enableVehicleClimate(this.vin);
}

public async disableClimate() {
public async disableDirectClimate() {
await this.porscheConnect.disableVehicleClimate(this.vin);
}
}

0 comments on commit daaa4e0

Please sign in to comment.