Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getChargeLimit and setChargeLimit is not a function #173

Open
Odaym opened this issue Jul 16, 2024 · 0 comments
Open

getChargeLimit and setChargeLimit is not a function #173

Odaym opened this issue Jul 16, 2024 · 0 comments

Comments

@Odaym
Copy link

Odaym commented Jul 16, 2024

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"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant