kamiKAC / leaf2mqtt

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

Can't seem to connect (2018 US Leaf) #20

Closed coogle closed 3 months ago

coogle commented 3 months ago

Describe the bug Brand new checkout of the code base running docker compose up after editing local_settings.env with my login and password doesn't work. It looks like based on the detailed log that there is a JSON decoding error (see below)


leaf2mqtt  | INFO: 2024-06-01 16:34:02.706410: main: V0.11
leaf2mqtt  | INFO: 2024-06-01 16:34:02.706666: MqttClientWrapper: Creating MQTT client with 10.11.12.2:1883 listening on leaf.
leaf2mqtt  | INFO: 2024-06-01 16:34:02.707762: MqttClientWrapper: Connecting...
leaf2mqtt  | INFO: 2024-06-01 16:34:02.712128: MqttClientWrapper: Mqtt connection code: MqttConnectReturnCode.connectionAccepted
leaf2mqtt  | INFO: 2024-06-01 16:34:02.712174: main: Logging in.
leaf2mqtt  | $ Invoking NissanConnect (NA) API: auth/authenticationForAAS
leaf2mqtt  | $ Params: {authenticate: {userid: XXX, password: XXX, brand-s: N, language-s: EN, country: US}}
leaf2mqtt  | $ Headers: {Content-Type: application/json, Api-Key: XXX, User-Agent-Key: XXX, User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; Android SDK built for x86 Build/LMY48X)}
leaf2mqtt  | $ JSON decoding failed!
leaf2mqtt  | WARNING: 2024-06-01 16:34:03.139163: 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.
leaf2mqtt  | FINE: 2024-06-01 16:34:03.139389: main: NoSuchMethodError: The method '[]' was called on null.
leaf2mqtt  | Receiver: null
leaf2mqtt  | Tried calling: []("authToken")
leaf2mqtt  | FINE: 2024-06-01 16:34:03.139599: main: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38)
leaf2mqtt  | #1      _objectNoSuchMethod (dart:core-patch/object_patch.dart:85)
leaf2mqtt  | #2      NissanConnectSession.login (package:dartnissanconnectna/src/nissanconnect_session.dart:133)
leaf2mqtt  | <asynchronous suspension>
leaf2mqtt  | #3      NissanConnectNASessionWrapper.login (file:///app/src/leaf/nissan_connect_na_wrapper.dart:24)
leaf2mqtt  | <asynchronous suspension>
leaf2mqtt  | #4      _login (file:///app/src/leaf_2_mqtt.dart:87)
leaf2mqtt  | <asynchronous suspension>
leaf2mqtt  | #5      main (file:///app/src/leaf_2_mqtt.dart:63)
leaf2mqtt  | <asynchronous suspension>
leaf2mqtt  |
leaf2mqtt  | WARNING: 2024-06-01 16:34:03.139658: main: Could not execute request.
leaf2mqtt  | FINEST: 2024-06-01 16:34:03.139691: MqttClientWrapper: Publishing message lastErrorDateTimeUtc 2024-06-01T16:34:03.139673Z

**LEAF_TYPE**

US 2018 Nissan Leaf (`olderUSA`)

**Expected behavior**

Obviously for it to login!
kamiKAC commented 3 months ago

Hi Did it work before? If so check if you can log in using MyLeaf for Android or MyLeaf for iOS as it's based on the same libraries. If you can't login using those apps leaf2mqtt will not work for you. You can also try to pull latest image (docker compose DO NOT refresh local image on startup) with docker pull kamikac/leaf2mqtt:latest I've also found this article but I'm not sure if it affects your car.

coogle commented 3 months ago

I can't seem to actually download that app (iOS) so I haven't tried it. This was a brand-new install / attempt so I assume I've already got the latest of everything -- and it hasn't worked before obviously.

John

kamiKAC commented 3 months ago

If you expect support please be more descriptive and provide:

Marcin

coogle commented 3 months ago

I provided a good amount of this already :)

Android App link:

https://play.google.com/store/apps/details?id=com.aqsmartphone.android.nissan&hl=en_US

iOS App link:

https://apps.apple.com/us/app/nissanconnect-ev-services/id407814405

kamiKAC commented 3 months ago

I'm afraid there is nothing I can do - leaf2mqtt depends on external libraries and thanks to Nissan USA support for your car has been dropped. See article https://tobis.dk/blog/the-farce-of-nissanconnect-north-america/