Tobiaswk / dartnissanconnect

Mirror of GitLab repository
https://gitlab.com/tobiaswkjeldsen/dartnissanconnect
MIT License
8 stars 2 forks source link

Battery info recovery #8

Open Loic31380 opened 11 months ago

Loic31380 commented 11 months ago

Hello,

For several weeks I have been trying to retrieve the battery data from my Nissan LEAF. The code provided as an example to retrieve the VIN works very well. However, I'm having a lot of trouble understanding the architect in order to obtain information about the battery, i.e. the charge level. Can you help me or show me the syntax I need to retrieve the battery info? Do I have to go through "nissanconnect_vehicle.dart" to get the information from "nissanconnect_battery.dart"?

Thank you for your help.

julien31520 commented 10 months ago

Dear Loic,

try this code :

import 'package:dartnissanconnect/dartnissanconnect.dart';

main() { NissanConnectSession session = new NissanConnectSession(debug: true);

session.login(username: "****", password: "**").then((battery) { battery.requestBatteryStatus(); }); }