feat(high-mobility): Implement get battery level action

This commit is contained in:
Faruk AYDIN
2023-09-19 21:23:31 +02:00
parent d1e7b6b9eb
commit 7a632c2ab9
2 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
import defineAction from '../../../../helpers/define-action';
export default defineAction({
name: 'Get Battery Level',
key: 'getBatteryLevel',
description: 'Get the battery level of a vehicle',
async run($) {
const response = await $.http.get(
`https://sandbox.rest-api.high-mobility.com/v5/charging`
);
$.setActionItem({
raw: {
batteryLevel: response.data.batteryLevel.data,
estimatedRange: response.data.estimatedRange.data,
},
});
},
});

View File

@@ -1,3 +1,4 @@
import getVehicleLocation from './get-vehicle-location'; import getVehicleLocation from './get-vehicle-location';
import getBatteryLevel from './get-battery-level';
export default [getVehicleLocation]; export default [getVehicleLocation, getBatteryLevel];