homebridge-fordpass
Advanced tools
Comparing version 1.6.1 to 1.7.0-test.0
@@ -55,3 +55,9 @@ { | ||
} | ||
} | ||
}, | ||
"chargingSwitch": { | ||
"title": "Charging Switch", | ||
"description": "Adds a button that can trigger automations when your vehicle begins charging.", | ||
"type": "boolean", | ||
"default": false | ||
} | ||
} | ||
@@ -58,0 +64,0 @@ } |
@@ -21,4 +21,12 @@ "use strict"; | ||
} | ||
removeService(serviceType, name) { | ||
const existingService = name | ||
? this.accessory.getServiceById(serviceType, `${this.accessory.displayName} ${name}`) | ||
: this.accessory.getService(serviceType); | ||
if (existingService) { | ||
this.accessory.removeService(existingService); | ||
} | ||
} | ||
} | ||
exports.FordpassAccessory = FordpassAccessory; | ||
//# sourceMappingURL=accessory.js.map |
@@ -37,3 +37,3 @@ "use strict"; | ||
configureAccessory(accessory) { | ||
var _a; | ||
var _a, _b; | ||
const self = this; | ||
@@ -50,2 +50,11 @@ this.log.info(`Configuring accessory ${accessory.displayName}`); | ||
const batteryService = fordAccessory.createService(hap.Service.Battery, ((_a = this.config.options) === null || _a === void 0 ? void 0 : _a.batteryName) || 'Fuel Level'); | ||
if ((_b = this.config.options) === null || _b === void 0 ? void 0 : _b.chargingSwitch) { | ||
const chargingService = fordAccessory.createService(hap.Service.StatelessProgrammableSwitch); | ||
chargingService.getCharacteristic(hap.Characteristic.ProgrammableSwitchEvent).setProps({ | ||
maxValue: hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS, | ||
}); | ||
} | ||
else { | ||
fordAccessory.removeService(hap.Service.StatelessProgrammableSwitch); | ||
} | ||
lockService.setCharacteristic(hap.Characteristic.LockCurrentState, defaultState); | ||
@@ -84,5 +93,5 @@ lockService | ||
.on("get", (callback) => __awaiter(this, void 0, void 0, function* () { | ||
var _b; | ||
var _c; | ||
let lockNumber = hap.Characteristic.LockTargetState.UNSECURED; | ||
const lockStatus = (_b = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _b === void 0 ? void 0 : _b.lockStatus.value; | ||
const lockStatus = (_c = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _c === void 0 ? void 0 : _c.lockStatus.value; | ||
if (lockStatus === 'LOCKED') { | ||
@@ -120,4 +129,4 @@ lockNumber = hap.Characteristic.LockTargetState.SECURED; | ||
.on("get", (callback) => __awaiter(this, void 0, void 0, function* () { | ||
var _c; | ||
const engineStatus = ((_c = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _c === void 0 ? void 0 : _c.remoteStartStatus.value) || 0; | ||
var _d; | ||
const engineStatus = ((_d = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _d === void 0 ? void 0 : _d.remoteStartStatus.value) || 0; | ||
callback(undefined, engineStatus); | ||
@@ -141,5 +150,5 @@ const status = yield vehicle.status(); | ||
.on("get", (callback) => __awaiter(this, void 0, void 0, function* () { | ||
var _d, _e, _f, _g, _h, _j, _k, _l; | ||
const fuel = (_e = (_d = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _d === void 0 ? void 0 : _d.fuel) === null || _e === void 0 ? void 0 : _e.fuelLevel; | ||
const battery = (_g = (_f = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _f === void 0 ? void 0 : _f.batteryFillLevel) === null || _g === void 0 ? void 0 : _g.value; | ||
var _e, _f, _g, _h, _j, _k, _l, _m; | ||
const fuel = (_f = (_e = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _e === void 0 ? void 0 : _e.fuel) === null || _f === void 0 ? void 0 : _f.fuelLevel; | ||
const battery = (_h = (_g = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _g === void 0 ? void 0 : _g.batteryFillLevel) === null || _h === void 0 ? void 0 : _h.value; | ||
let level = fuel || battery || 100; | ||
@@ -155,5 +164,5 @@ if (level > 100) { | ||
if (status) { | ||
const fuel = (_h = status.fuel) === null || _h === void 0 ? void 0 : _h.fuelLevel; | ||
const battery = (_j = status.batteryFillLevel) === null || _j === void 0 ? void 0 : _j.value; | ||
const chargingStatus = (_l = (_k = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _k === void 0 ? void 0 : _k.chargingStatus) === null || _l === void 0 ? void 0 : _l.value; | ||
const fuel = (_j = status.fuel) === null || _j === void 0 ? void 0 : _j.fuelLevel; | ||
const battery = (_k = status.batteryFillLevel) === null || _k === void 0 ? void 0 : _k.value; | ||
const chargingStatus = (_m = (_l = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _l === void 0 ? void 0 : _l.chargingStatus) === null || _m === void 0 ? void 0 : _m.value; | ||
let level = fuel || battery || 100; | ||
@@ -248,2 +257,3 @@ if (level > 100) { | ||
this.vehicles.forEach((vehicle) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
const status = yield vehicle.status(); | ||
@@ -263,9 +273,22 @@ this.log.debug(`Updating info for ${vehicle.name}`); | ||
const accessory = this.accessories.find((x) => x.UUID === uuid); | ||
if (!this.pendingLockUpdate) { | ||
const lockService = accessory === null || accessory === void 0 ? void 0 : accessory.getService(hap.Service.LockMechanism); | ||
lockService && lockService.updateCharacteristic(hap.Characteristic.LockCurrentState, lockNumber); | ||
lockService && lockService.updateCharacteristic(hap.Characteristic.LockTargetState, lockNumber); | ||
if (accessory) { | ||
if (!this.pendingLockUpdate) { | ||
const lockService = accessory.getService(hap.Service.LockMechanism); | ||
lockService && lockService.updateCharacteristic(hap.Characteristic.LockCurrentState, lockNumber); | ||
lockService && lockService.updateCharacteristic(hap.Characteristic.LockTargetState, lockNumber); | ||
} | ||
const switchService = accessory.getService(hap.Service.Switch); | ||
switchService && switchService.updateCharacteristic(hap.Characteristic.On, started); | ||
if (((_a = this.config.options) === null || _a === void 0 ? void 0 : _a.chargingSwitch) && | ||
((_b = status === null || status === void 0 ? void 0 : status.chargingStatus) === null || _b === void 0 ? void 0 : _b.value) === 'ChargingAC' && | ||
!accessory.context.charge) { | ||
const chargingService = accessory.getService(hap.Service.StatelessProgrammableSwitch); | ||
chargingService && | ||
chargingService.updateCharacteristic(hap.Characteristic.ProgrammableSwitchEvent, hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS); | ||
accessory.context.charge = true; | ||
} | ||
else if (accessory.context.charge) { | ||
accessory.context.charge = false; | ||
} | ||
} | ||
const switchService = accessory === null || accessory === void 0 ? void 0 : accessory.getService(hap.Service.Switch); | ||
switchService && switchService.updateCharacteristic(hap.Characteristic.On, started); | ||
})); | ||
@@ -272,0 +295,0 @@ }); |
{ | ||
"displayName": "Homebridge FordPass", | ||
"name": "homebridge-fordpass", | ||
"version": "1.6.1", | ||
"version": "1.7.0-test.0", | ||
"description": "Fordpass plugin for homebridge: https://homebridge.io/", | ||
@@ -53,3 +53,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"axios": "^0.24.0" | ||
"axios": "^0.27.2" | ||
}, | ||
@@ -65,3 +65,3 @@ "devDependencies": { | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"homebridge": "^1.3.9", | ||
"homebridge": "^1.4.1", | ||
"jest": "^27.4.5", | ||
@@ -68,0 +68,0 @@ "prettier": "^2.5.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97198
727
2
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedaxios@0.24.0(transitive)
Updatedaxios@^0.27.2