homebridge-fordpass
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -42,3 +42,3 @@ "use strict"; | ||
try { | ||
const result = yield axios_1.default(options); | ||
const result = yield (0, axios_1.default)(options); | ||
if (result.status === 200) { | ||
@@ -45,0 +45,0 @@ this.config.access_token = result.data.access_token; |
@@ -53,6 +53,8 @@ "use strict"; | ||
}; | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
if (options.headers) { | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
} | ||
try { | ||
const result = yield axios_1.default(options); | ||
const result = yield (0, axios_1.default)(options); | ||
if (result.status === 200 && result.data.status === 200) { | ||
@@ -117,5 +119,7 @@ this.info = result.data.vehiclestatus; | ||
}; | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
const result = yield axios_1.default(options); | ||
if (options.headers) { | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
} | ||
const result = yield (0, axios_1.default)(options); | ||
if (result.status !== 200) { | ||
@@ -151,5 +155,7 @@ handleError('IssueCommand', result.status, this.log); | ||
}; | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
const result = yield axios_1.default(options); | ||
if (options.headers) { | ||
options.headers['Application-Id'] = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
options.headers['auth-token'] = this.config.access_token; | ||
} | ||
const result = yield (0, axios_1.default)(options); | ||
if (result.status === 200) { | ||
@@ -156,0 +162,0 @@ return result.data; |
@@ -136,3 +136,3 @@ "use strict"; | ||
.on("get", (callback) => __awaiter(this, void 0, void 0, function* () { | ||
var _c, _d, _e, _f, _g, _h; | ||
var _c, _d, _e, _f, _g, _h, _j, _k; | ||
const fuel = (_d = (_c = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _c === void 0 ? void 0 : _c.fuel) === null || _d === void 0 ? void 0 : _d.fuelLevel; | ||
@@ -144,2 +144,5 @@ const battery = (_f = (_e = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _e === void 0 ? void 0 : _e.batteryFillLevel) === null || _f === void 0 ? void 0 : _f.value; | ||
} | ||
if (level < 0) { | ||
level = 0; | ||
} | ||
callback(undefined, level); | ||
@@ -150,2 +153,3 @@ const status = yield vehicle.status(); | ||
const battery = (_h = status.batteryFillLevel) === null || _h === void 0 ? void 0 : _h.value; | ||
const chargingStatus = (_k = (_j = vehicle === null || vehicle === void 0 ? void 0 : vehicle.info) === null || _j === void 0 ? void 0 : _j.chargingStatus) === null || _k === void 0 ? void 0 : _k.value; | ||
let level = fuel || battery || 100; | ||
@@ -155,3 +159,23 @@ if (level > 100) { | ||
} | ||
if (level < 0) { | ||
level = 0; | ||
} | ||
batteryService.updateCharacteristic(hap.Characteristic.BatteryLevel, level); | ||
if (battery) { | ||
if (chargingStatus === 'ChargingAC') { | ||
batteryService.updateCharacteristic(hap.Characteristic.ChargingState, hap.Characteristic.ChargingState.CHARGING); | ||
} | ||
else { | ||
batteryService.updateCharacteristic(hap.Characteristic.ChargingState, hap.Characteristic.ChargingState.NOT_CHARGING); | ||
} | ||
} | ||
else { | ||
batteryService.updateCharacteristic(hap.Characteristic.ChargingState, hap.Characteristic.ChargingState.NOT_CHARGEABLE); | ||
} | ||
if (level < 10) { | ||
batteryService.updateCharacteristic(hap.Characteristic.StatusLowBattery, hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW); | ||
} | ||
else { | ||
batteryService.updateCharacteristic(hap.Characteristic.StatusLowBattery, hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL); | ||
} | ||
} | ||
@@ -162,4 +186,2 @@ else { | ||
})); | ||
batteryService.setCharacteristic(hap.Characteristic.ChargingState, hap.Characteristic.ChargingState.NOT_CHARGEABLE); | ||
batteryService.setCharacteristic(hap.Characteristic.StatusLowBattery, hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL); | ||
this.vehicles.push(vehicle); | ||
@@ -166,0 +188,0 @@ this.accessories.push(accessory); |
{ | ||
"displayName": "Homebridge FordPass", | ||
"name": "homebridge-fordpass", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Fordpass plugin for homebridge: https://homebridge.io/", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
"build": "rimraf ./dist ./coverage && tsc", | ||
"deploy": "./dev/deploy.sh", | ||
"deploy": "npm run build && ./dev/deploy.sh", | ||
"packlist": "npm pack --dry-run && rm *.tgz", | ||
@@ -58,20 +58,20 @@ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
"axios": "^0.24.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.23.0", | ||
"@typescript-eslint/parser": "^4.23.0", | ||
"eslint": "^7.26.0", | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^16.11.9", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"eslint": "^8.2.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"homebridge": "^1.3.4", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.3.0", | ||
"eslint-plugin-jest": "^25.2.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"homebridge": "^1.3.6", | ||
"jest": "^27.3.1", | ||
"prettier": "^2.4.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^26.5.6", | ||
"typescript": "^4.2.4" | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.5.2" | ||
} | ||
} |
@@ -46,2 +46,5 @@ <p align="center"> | ||
], | ||
"options": { | ||
"autoRefresh": false | ||
}, | ||
"platform": "FordPass" | ||
@@ -48,0 +51,0 @@ } |
Sorry, the diff of this file is not supported yet
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
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
87616
607
63
+ Addedaxios@0.24.0(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.24.0