yp87 / leaf2mqtt

Pull in data from the Nissan Connect platform for the LEAF and publish over MQTT
GNU General Public License v3.0
42 stars 39 forks source link

LeafSession: NoSuchMethodError: The method '[]' was called on null. #72

Open JulienLivet opened 8 months ago

JulienLivet commented 8 months ago

hi

LEAF_USERNAME: Login@login.com
LEAF_PASSWORD: "password"
LEAF_TYPE: newerThanMay2019
MQTT_HOST: 192.168.1.104
MQTT_PORT: 1883
MQTT_USERNAME: mqttuser
MQTT_PASSWORD: paswword
MQTT_BASE_TOPIC: leaf
UPDATE_INTERVAL_MINUTES: 45
CHARGING_UPDATE_INTERVAL_MINUTES: 10
COMMAND_ATTEMPTS: 3
LOG_LEVEL: All

I'm using the add-on for Home Assistant. I have latitude, longitude, mileage, and temperature. I don't have any other information, and I have the following error in the logs.

FINE: 2024-02-20 02:32:59.393866: LeafSession: NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: []("realm")
FINER: 2024-02-20 02:32:59.393936: LeafSession: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38)
#1      _objectNoSuchMethod (dart:core-patch/object_patch.dart:85)
#2      NissanConnectSession.login (package:dartnissanconnect/src/nissanconnect_session.dart:299)
<asynchronous suspension>
#3      NissanConnectSessionWrapper.login (file:///app/src/leaf/nissan_connect_wrapper.dart:21)
<asynchronous suspension>
#4      LeafSession._executeWithRetry (file:///app/src/leaf/leaf_session.dart:146)
<asynchronous suspension>
#5      LeafSession.executeWithRetry (file:///app/src/leaf/leaf_session.dart:129)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:522)
<asynchronous suspension>

FINEST: 2024-02-20 02:32:59.393943: LeafSession: Executing
FINE: 2024-02-20 02:32:59.760658: LeafSession: RangeError (length): Invalid value: Not in inclusive range 0..3: 4
FINER: 2024-02-20 02:32:59.760711: LeafSession: #0      new NissanConnectBattery (package:dartnissanconnect/src/nissanconnect_battery.dart)
#1      NissanConnectVehicle.requestBatteryStatus (package:dartnissanconnect/src/nissanconnect_vehicle.dart:53)
<asynchronous suspension>
#2      NissanConnectVehicleWrapper.fetchBatteryStatus (file:///app/src/leaf/nissan_connect_wrapper.dart:69)
<asynchronous suspension>
#3      LeafSession._executeWithRetry (file:///app/src/leaf/leaf_session.dart:153)
<asynchronous suspension>
#4      LeafSession.executeWithRetry (file:///app/src/leaf/leaf_session.dart:129)
<asynchronous suspension>
#5      Future.wait.<anonymous closure> (dart:async/future.dart:522)
<asynchronous suspension>

FINE: 2024-02-20 02:32:59.760731: LeafSession: Exception: Execution failed.
FINER: 2024-02-20 02:32:59.760743: LeafSession: #0      LeafSession._executeWithRetry (file:///app/src/leaf/leaf_session.dart:161)
<asynchronous suspension>
#1      LeafSession.executeWithRetry (file:///app/src/leaf/leaf_session.dart:129)
<asynchronous suspension>
#2      Future.wait.<anonymous closure> (dart:async/future.dart:522)
<asynchronous suspension>

WARNING: 2024-02-20 02:32:59.760752: main: Could not execute request.
FINEST: 2024-02-20 02:32:59.760758: MqttClientWrapper: Publishing message lastErrorDateTimeUtc 2024-02-20T01:32:59.760755Z
FINEST: 2024-02-20 02:32:59.760999: MqttClientWrapper: Publishing message {vin}/lastErrorDateTimeUtc 2024-02-20T01:32:59.760755Z

`thx :)`
JulienLivet commented 8 months ago

Hello, it works without any adjustments. No more trace of that error. It seems like using the vehicle might have resolved the issue, but I'm not entirely sure.

compuguy commented 8 months ago

Hello, it works without any adjustments. No more trace of that error. It seems like using the vehicle might have resolved the issue, but I'm not entirely sure.

Odd, I'm having a similar issue I think @JulienLivet...

WARNING: 2024-02-22 18:31:53.618286: main: An error occured while logging in. Please make sure you have selected the right LEAF_TYPE, LEAF_USERNAME and LEAF_PASSWORD. Retrying in 5 seconds.
FINE: 2024-02-22 18:31:53.618561: main: NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: []("realm")
FINE: 2024-02-22 18:31:53.618815: main: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38)
#1      _objectNoSuchMethod (dart:core-patch/object_patch.dart:85)
#2      NissanConnectSession.login (package:dartnissanconnect/src/nissanconnect_session.dart:299)
<asynchronous suspension>
#3      NissanConnectSessionWrapper.login (file:///app/src/leaf/nissan_connect_wrapper.dart:21)
<asynchronous suspension>
#4      _login (file:///app/src/leaf_2_mqtt.dart:87)
<asynchronous suspension>
#5      main (file:///app/src/leaf_2_mqtt.dart:63)
<asynchronous suspension>

WARNING: 2024-02-22 18:31:53.618878: main: Could not execute request.
FINEST: 2024-02-22 18:31:53.618955: MqttClientWrapper: Publishing message lastErrorDateTimeUtc 2024-02-22T23:31:53.618937Z