UNPKG

homebridge-tessie

Version:

Connect Homebridge to your Tessie account.

18 lines 884 B
import { BaseService } from "./base.js"; export class ChargeSwitchService extends BaseService { constructor(parent) { super(parent, parent.platform.Service.Switch, "Charge", "charge"); const on = this.service .getCharacteristic(this.parent.platform.Characteristic.On) .onSet(async (value) => { this.parent.wakeUpAndWait() .then(() => value ? this.parent.vehicle.charge_start() : this.parent.vehicle.charge_stop()) .then(() => on.updateValue(value)) .catch((e) => this.log.error(`${this.name} vehicle charge_start failed: ${e}`)); }); this.parent.emitter.on("vehicle_data", (data) => { on.updateValue(data.charge_state?.user_charge_enable_request ?? data.charge_state?.charge_enable_request); }); } } //# sourceMappingURL=chargeswitch.js.map