Skip to content

Commit

Permalink
fix ignition logic (SteffeyDev#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
athal7 authored Apr 29, 2021
1 parent a674d4d commit 7fb0d53
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/services/ignition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,18 @@ export class Ignition extends HyundaiService {
setCurrentState(status: VehicleStatus): void {
if (status.engine.ignition !== this.isOn) {
this.isOn = status.engine.ignition
this.shouldTurnOn = this.isOn

this.log.info(`Vehicle is ${this.isOn ? 'On' : 'Off'}`)
this.service?.updateCharacteristic(
this.Characteristic.On,
this.isOn
)
}
}
get shouldTurnOn(): boolean {
return this._shouldTurnOn === undefined
? !!this.isOn
: this._shouldTurnOn
get shouldTurnOn(): boolean | undefined {
return this._shouldTurnOn
}
set shouldTurnOn(value: boolean) {
set shouldTurnOn(value: boolean | undefined) {
this._shouldTurnOn = value
// Check on status & reset after 1 minute
setTimeout(() => {
Expand Down

0 comments on commit 7fb0d53

Please sign in to comment.