homebridge-tessie
Version:
Connect Homebridge to your Tessie account.
19 lines • 922 B
JavaScript
import { debounce } from "../utils/debounce.js";
import { BaseService } from "./base.js";
export class BackupReserve extends BaseService {
constructor(parent) {
super(parent, parent.platform.Service.Switch, "Backup Reserve", "backup_reserve");
const on = this.service
.getCharacteristic(this.parent.platform.Characteristic.On);
const level = this.service
.getCharacteristic(this.parent.platform.Characteristic.Brightness)
.onSet(debounce((value) => this.energy.backup(value)
.then(() => level.updateValue(value))
.catch((e) => this.log.error(`${this.name} vehicle backup failed: ${e}`)), 3000));
this.parent.emitter.on("site_info", (data) => {
on.updateValue(data.backup_reserve_percent > 0);
level.updateValue(data.backup_reserve_percent);
});
}
}
//# sourceMappingURL=backupreserve.js.map