feat(smartcard): Add get ev battery level integration
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Get EV Battery Level',
|
||||||
|
key: 'getEvBatteryLevel',
|
||||||
|
description: 'Get the battery level of an electric vehicle.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Vehicle',
|
||||||
|
key: 'vehicle',
|
||||||
|
type: 'dropdown' as const,
|
||||||
|
required: true,
|
||||||
|
description: 'The vehicle to get the location of.',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listVehicles',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const { vehicle } = $.step.parameters;
|
||||||
|
const response = await $.http.get(
|
||||||
|
`/vehicles/${vehicle}/battery?mode=simulated`
|
||||||
|
);
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
@@ -1,3 +1,4 @@
|
|||||||
import getVehicleLocation from './get-vehicle-location';
|
import getVehicleLocation from './get-vehicle-location';
|
||||||
|
import getEvBatteryLevel from './get-ev-battery-level';
|
||||||
|
|
||||||
export default [getVehicleLocation];
|
export default [getVehicleLocation, getEvBatteryLevel];
|
||||||
|
@@ -4,8 +4,9 @@ import { URLSearchParams } from 'url';
|
|||||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||||
const scopes = [
|
const scopes = [
|
||||||
'read_odometer',
|
'read_odometer',
|
||||||
'read_vehicle_info',
|
'required:read_vehicle_info',
|
||||||
'required:read_location',
|
'required:read_location',
|
||||||
|
'required:read_battery',
|
||||||
];
|
];
|
||||||
|
|
||||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||||
|
Reference in New Issue
Block a user