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

Unable to login. LEAF_TYPE=olderEurope #22

Closed bonaas closed 3 months ago

bonaas commented 3 months ago

Describe the bug The docker container is unable to login. Only returning "An error occured while logging in.". It used to work with "yp87/leaf2mqtt". "My Leaf" from Tobias is working fine. I have verified that the username/email and password is the same in "My Leaf" as the local_settings_leaf.env.

LEAF_TYPE LEAF_TYPE=olderEurope Leaf 2018. Europe.

Expected behavior Successful connection.

docker-compose.yaml

  leaf2mqtt:
    container_name: leaf2mqtt
#    image: yp87/leaf2mqtt
    image: kamikac/leaf2mqtt:latest
    restart: unless-stopped
    environment:
      - TZ=Europe/Oslo
    logging:
      options:
        max-size: "1M"
        max-file: "5"
    env_file:
      - local_settings_leaf.env

local_settings_leaf.env

################
### Required ###
################

LEAF_USERNAME=b**********.com
LEAF_PASSWORD=A********B

#LEAF_TYPE=newerThanMay2019
#LEAF_TYPE=olderCanada
#LEAF_TYPE=olderUSA
LEAF_TYPE=olderEurope
#LEAF_TYPE=olderAustralia
#LEAF_TYPE=olderJapan

MQTT_HOST=192.168.1.16

################
### Optional ###
################

#MQTT_PORT=1883
#MQTT_USERNAME=my_mqtt_user
#MQTT_PASSWORD=my_mqtt_password
MQTT_BASE_TOPIC=leaf
UPDATE_INTERVAL_MINUTES=60
CHARGING_UPDATE_INTERVAL_MINUTES=5
COMMAND_ATTEMPTS=2
LOG_LEVEL=All

Log

> leaf2mqtt  | INFO: 2024-06-13 09:40:29.343959: main: V0.11
> leaf2mqtt  | INFO: 2024-06-13 09:40:29.344013: MqttClientWrapper: Creating MQTT client with 192.168.1.16:1883 listening on leaf.
> leaf2mqtt  | INFO: 2024-06-13 09:40:29.344114: MqttClientWrapper: Connecting...
> leaf2mqtt  | INFO: 2024-06-13 09:40:29.344883: MqttClientWrapper: Mqtt connection code: MqttConnectReturnCode.connectionAccepted
> leaf2mqtt  | INFO: 2024-06-13 09:40:29.344891: main: Logging in.
> leaf2mqtt  | WARNING: 2024-06-13 09:40:30.436810: 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-13 09:40:30.436850: main: FormatException: Unexpected character (at character 1)
> leaf2mqtt  | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> leaf2mqtt  | ^
> leaf2mqtt  |
> leaf2mqtt  | FINE: 2024-06-13 09:40:30.436965: main: #0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383)
> leaf2mqtt  | #1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250)
> leaf2mqtt  | #2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915)
> leaf2mqtt  | #3      _parseJson (dart:convert-patch/convert_patch.dart:35)
> leaf2mqtt  | #4      JsonDecoder.convert (dart:convert/json.dart:610)
> leaf2mqtt  | #5      JsonCodec.decode (dart:convert/json.dart:216)
> leaf2mqtt  | #6      CarwingsSession.request (package:dartcarwings/src/carwings_session.dart:72)
> leaf2mqtt  | <asynchronous suspension>
> leaf2mqtt  | #7      CarwingsSession.login (package:dartcarwings/src/carwings_session.dart:94)
> leaf2mqtt  | <asynchronous suspension>
> leaf2mqtt  | #8      CarwingsWrapper.login (file:///app/src/leaf/carwings_wrapper.dart:21)
> leaf2mqtt  | <asynchronous suspension>
> leaf2mqtt  | #9      _login (file:///app/src/leaf_2_mqtt.dart:87)
> leaf2mqtt  | <asynchronous suspension>
> leaf2mqtt  | #10     main (file:///app/src/leaf_2_mqtt.dart:63)
> leaf2mqtt  | <asynchronous suspension>
> leaf2mqtt  |
> leaf2mqtt  | WARNING: 2024-06-13 09:40:30.436979: main: Could not execute request.
> leaf2mqtt  | FINEST: 2024-06-13 09:40:30.436993: MqttClientWrapper: Publishing message lastErrorDateTimeUtc 2024-06-13T09:40:30.436987Z
> 
kamiKAC commented 3 months ago

Hi Which region did you choose when logging into MyLeaf app? Did you try to issue docker pull kamikac/leaf2mqtt:latest before docker compose? Do you have any special characters in your login/password? BR Marcin

bonaas commented 3 months ago

Hi Marcin,

In the MyLeaf app, I use Region: Europe.

docker pull kamikac/leaf2mqtt:latest

/Docker$ docker pull kamikac/leaf2mqtt:latest
latest: Pulling from kamikac/leaf2mqtt
Digest: sha256:841ce1630bab07a1fde73141b4aa96dbda913b3d31f6889f06b4d77add1983c8
Status: Image is up to date for kamikac/leaf2mqtt:latest
docker.io/kamikac/leaf2mqtt:latest

Regarding the password. Yes, I use an exclamation mark "!" in the password, as it is an requirement when changeing password (one special character (!@#$%&*)).

BRG, Bjørn

kamiKAC commented 3 months ago

Hi

Please try to change image to kamikac/leaf2mqtt:v0.0.3-edge.

BR Marcin

bonaas commented 3 months ago

Hi Marcin,

Seem to be working very good. Thanks for the support :-)

~/Docker$ docker pull kamikac/leaf2mqtt:v0.0.3-edge
v0.0.3-edge: Pulling from kamikac/leaf2mqtt
95e9e7e4ec7f: Already exists
c869eccc3755: Pull complete
Digest: sha256:73b4f0ae125885e9160cd8f26a9d0d2a81a47001f0043daee68d57980dd7c39e
Status: Downloaded newer image for kamikac/leaf2mqtt:v0.0.3-edge
docker.io/kamikac/leaf2mqtt:v0.0.3-edge
~/Docker$ docker compose up leaf2mqtt
[+] Running 1/0
 ✔ Container leaf2mqtt  Recreated                                                                                                                                                                                                                                                                                       0.0s
Attaching to leaf2mqtt
leaf2mqtt  | INFO: 2024-06-14 05:22:30.412362: main: Version: v0.0.3-edge
leaf2mqtt  | INFO: 2024-06-14 05:22:30.412421: MqttClientWrapper: Creating MQTT client with 192.168.1.16:1883 listening on leaf.
leaf2mqtt  | INFO: 2024-06-14 05:22:30.412517: MqttClientWrapper: Connecting...
leaf2mqtt  | INFO: 2024-06-14 05:22:30.413206: MqttClientWrapper: Mqtt connection code: MqttConnectReturnCode.connectionAccepted
leaf2mqtt  | INFO: 2024-06-14 05:22:30.413213: main: Logging in.
leaf2mqtt  | INFO: 2024-06-14 05:22:59.935877: main: Login successful
leaf2mqtt  | INFO: 2024-06-14 05:22:59.935907: main: MQTT connected.
leaf2mqtt  | INFO: 2024-06-14 05:22:59.935915: MqttClientWrapper: Subscribing to command topics

BRG, Bjørn

kamiKAC commented 3 months ago

Solved with build v0.0.4 (#23) image: kamikac/leaf2mqtt:v0.0.4

Jopand commented 3 months ago

Please remember to update the version tag in https://github.com/kamiKAC/leaf2mqtt/blob/main/addon/config.json

kamiKAC commented 2 months ago

Thanks for the reminder. I've corrected release-please config so tag gets updated automatically :)

Jopand commented 2 months ago

The addon update showed up in HA. But cannot update due to an "unknown manifest" :-S

I ended up running the docker container directly. But just letting you know that the addon still does not work

kamiKAC commented 2 months ago

I don't use HA so I cant test. I found tag was leaf2mqtt-v0.0.4 instead v0.0.4. Its fixed now. Could you please check once again?

Jopand commented 2 months ago

Still not working. Have a look at the config file inside the addon folder. You've changed it from "v0.0.3" (which was working) to "0.0.4" (which is not working). Try with "v0.0.4"

kamiKAC commented 2 months ago

@Jopand Thanks for pointing the right direction 👍 Unfortunately release-please does not support extra-files with version format including v so I had to make a workaround. Next time it should update add-on version properly 😄