Skip to content

Commit

Permalink
feat: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavishyachandra committed Jul 23, 2023
1 parent 1e829e4 commit bd0c055
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: daily
time: "04:00"
time: '04:00'
assignees:
- "bhavishyachandra"
- 'bhavishyachandra'
reviewers:
- "bhavishyachandra"
- 'bhavishyachandra'
3 changes: 2 additions & 1 deletion src/accessories/leakSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class LeakSensorAccessory {
handleDeviceStateChanged(event: WSEvent) {
this.platform.log.debug('Received websocket leak event:', event);
switch (event.name) {
case 'leak':
case 'leak': {
const leak = this._getLeakDetectedCharacteristicValue(
event.last_read_state === 'true'
);
Expand All @@ -101,6 +101,7 @@ export class LeakSensorAccessory {
leak
);
break;
}
}
}
}
7 changes: 2 additions & 5 deletions src/accessories/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ export class LockAccessory {
async handleLockTargetStateSet(value: CharacteristicValue) {
this.platform.log.debug('Triggered SET LockTargetState:', value);
this.state.locked.target = value;
const lockAttributes = await this.platform.smartRentApi.setState<
Lock,
LockAttributes
>(this.state.hubId, this.state.deviceId, { locked: !!value });
this.platform.log.debug('Triggered SET LockTargetState:', value);
}

Expand All @@ -157,7 +153,7 @@ export class LockAccessory {
async handleLockEvent(event: WSEvent) {
this.platform.log.debug('Recieved event on Lock: ', event);
switch (event.name) {
case 'locked':
case 'locked': {
const currentValue = this._getLockStateCharacteristicValue(
event.last_read_state === 'true'
);
Expand All @@ -170,6 +166,7 @@ export class LockAccessory {
currentValue
);
break;
}
case 'notifications':
break;
}
Expand Down
31 changes: 21 additions & 10 deletions src/accessories/thermostat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class ThermostatAccessory {
`Device ${this.state.deviceId} state changed: ${JSON.stringify(event)}`
);
switch (event.name) {
case 'fan_mode':
case 'fan_mode': {
const fanMode = this.toFanOnCharacteristic(
event.last_read_state as ThermostatFanMode
);
Expand All @@ -188,25 +188,31 @@ export class ThermostatAccessory {
fanMode
);
break;
case 'mode':
}
case 'mode': {
const mode = this.toTargetHeatingCoolingStateCharacteristic(
event.last_read_state as ThermostatMode
);
let actualMode = mode;
if (mode === this.platform.Characteristic.TargetHeatingCoolingState.AUTO) {
if (
mode === this.platform.Characteristic.TargetHeatingCoolingState.AUTO
) {
// Determine if heating or cooling based on target and current temperature
if (
this.state.target_temperature.current <
this.state.current_temperature.current
) {
actualMode = this.platform.Characteristic.CurrentHeatingCoolingState.COOL;
actualMode =
this.platform.Characteristic.CurrentHeatingCoolingState.COOL;
} else if (
this.state.target_temperature.current >
this.state.current_temperature.current
) {
actualMode = this.platform.Characteristic.CurrentHeatingCoolingState.HEAT;
actualMode =
this.platform.Characteristic.CurrentHeatingCoolingState.HEAT;
} else {
actualMode = this.platform.Characteristic.CurrentHeatingCoolingState.OFF;
actualMode =
this.platform.Characteristic.CurrentHeatingCoolingState.OFF;
}
}
this.state.heating_cooling_state.current = actualMode;
Expand All @@ -220,7 +226,8 @@ export class ThermostatAccessory {
mode
);
break;
case 'cooling_setpoint':
}
case 'cooling_setpoint': {
const coolingSetpoint = this.toTemperatureCharacteristic(
Number(event.last_read_state)
);
Expand All @@ -231,7 +238,8 @@ export class ThermostatAccessory {
coolingSetpoint
);
break;
case 'heating_setpoint':
}
case 'heating_setpoint': {
const heatingSetpoint = this.toTemperatureCharacteristic(
Number(event.last_read_state)
);
Expand All @@ -242,7 +250,8 @@ export class ThermostatAccessory {
heatingSetpoint
);
break;
case 'current_temp':
}
case 'current_temp': {
const temperature = this.toTemperatureCharacteristic(
Number(event.last_read_state)
);
Expand All @@ -252,14 +261,16 @@ export class ThermostatAccessory {
temperature
);
break;
case 'current_humidity':
}
case 'current_humidity': {
const humidity = Math.round(Number(event.last_read_state));
this.state.current_relative_humidity.current = humidity;
this.thermostatService.updateCharacteristic(
this.platform.Characteristic.CurrentRelativeHumidity,
humidity
);
break;
}
}
}

Expand Down

0 comments on commit bd0c055

Please sign in to comment.