CEC-2291 Remote Commands (#194)

This commit is contained in:
arpanetus
2022-09-07 23:21:57 +06:00
committed by GitHub
parent 153c6bdcf7
commit aa5a1e20e0
19 changed files with 1187 additions and 148 deletions

View File

@@ -94,11 +94,10 @@ const vehiclesAPI = {
data: [2021, 2022],
};
},
sendCommand: async (vin, command, parameters) => {
sendCommand: async (vin, command) => {
return {
vin,
command,
parameters,
};
},
updateVehicle: async (vin, vehicle) => {

View File

@@ -1,81 +1,26 @@
const Locks = [
const Commands = [
{value: "doors_lock", label: "Lock doors"},
{value: "doors_unlock", label: "Unlock doors"},
{value: "vent_windows", label: "Vent windows"},
{value: "close_windows", label: "Close windows"},
{value: "california_mode", label: "California mode"},
{value: "trunk_open", label: "Open trunk"},
{value: "trunk_close", label: "Close trunk "},
{value: "flash_headlights", label: "Flash headlights"},
{value: "alert", label: "Alert"},
{value: "temp_cabin", label: "Set cabin temperature"},
{
value: "right_front",
label: "Front right door",
},{
value: "left_front",
label: "Front left door",
},{
value: "right_rear",
label: "Rear right door",
},{
value: "left_rear",
label: "Rear left door",
},{
value: "trunk",
label: "Trunk",
value: "temp_cabin",
label: "Set cabin temperature for period",
params: {
data: ""
},
},
];
const Windows = [
{
value: "right_front",
label: "Front right window",
},{
value: "left_front",
label: "Front left window",
},{
value: "right_rear",
label: "Rear right window",
},{
value: "left_rear",
label: "Rear left window",
},
];
const Commands = [{
value: "lock",
label: "Lock door",
parameters: Locks,
},
{
value: "unlock",
label: "Unlock door",
parameters: Locks,
},{
value: "open",
label: "Open window",
parameters: Windows,
},
{
value: "close",
label: "Close window",
parameters: Windows,
},
{
value: "ecu",
label: "ECU Versions",
},
{
value: "log",
label: "Log level",
parameters: [
{
value: "info",
label: "Info",
},
{
value: "debug",
label: "Debug",
},
{
value: "trace",
label: "Trace",
},
],
},{
value: "headlights",
label: "Flash headlights",
}];
{value: "defrost", label: "Defrost"},
{value: "driver_seat_preheat", label: "Driver seat preheat"},
{value: "passenger_seat_preheat", label: "Preheat passenger seat"},
{value: "steering_wheel_preheat", label: "Preheat Steering wheel"},
{value: "precondition", label: "Precondition"},
{value: "charging", label: "Charging"}]
export default Commands;

View File

@@ -125,7 +125,7 @@ const vehiclesAPI = {
.then(fetchRespHandler)
.catch(errorHandler),
sendCommand: async (vins, command, parameters, token) =>
sendCommand: async (vins, command, token) =>
fetch(`${API_ENDPOINT}/vehiclecommand`, {
method: "POST",
headers: Object.assign(
@@ -134,8 +134,7 @@ const vehiclesAPI = {
),
body: JSON.stringify({
vins,
command,
parameters,
...command,
}),
})
.then(fetchRespHandler)