Skip to content

getChargeLimit and setChargeLimit is not a function #173

Description

@Odaym

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

  • 2019 Tesla Model 3
  • 2023 BMW I4 EDrive40
  • 2023 Audi e-tron
  • 2019 MINI Cooper SE

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"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions