smartcar / node-sdk

Smartcar Node.js SDK
MIT License
49 stars 14 forks source link

getChargeLimit and setChargeLimit is not a function #173

Open Odaym opened 1 month ago

Odaym commented 1 month ago

Hi, I'm trying to set/get charge limit on several cars that I have, they are:

and on all these cars, I get back the following error when trying to get or set charge limit using the following code:

app.get('/charge/limit', checkAccessToken, async (req, res) => {
  try {
    const { vehicles } = await smartcar.getVehicles(access.accessToken);
    if (!vehicles.length) {
      throw new Error('No vehicles found.');
    }
    const vehicle = new smartcar.Vehicle(vehicles[0], access.accessToken);
    const chargeLimit = await vehicle.getChargeLimit();
    res.json(chargeLimit);
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});
<-- 500 Internal Server Error http://10.0.2.2:8000/charge/limit?accessToken=839ef1dc-ae4c-4432-bf09-32fc5dc9a9a5 (808ms)
10:08:44.586  I  X-Powered-By: Express
10:08:44.586  I  Content-Type: application/json; charset=utf-8
10:08:44.586  I  Content-Length: 52
10:08:44.586  I  ETag: W/"34-2mMGudYXKNPJ5R3gWWfz2c/XMQw"
10:08:44.586  I  Date: Tue, 16 Jul 2024 08:08:45 GMT
10:08:44.586  I  Connection: keep-alive
10:08:44.586  I  Keep-Alive: timeout=5
10:08:44.587  I  {"error":"vehicle.getChargeLimit is not a function"}