joeshaw / carwings

Go package and CLI tool for the Nissan Leaf Carwings API
MIT License
31 stars 11 forks source link

ERROR: vehicle info unavailable #33

Closed lezoid closed 3 years ago

lezoid commented 4 years ago

ERROR: vehicle info unavailable Japan 2018 model (40kwh / ZE1 type).

EndPointAPI:NML(Japan)

The JP2018 model leaf is experiencing behavior that appears to be a failure of json analysis. Since json is returning a normal response, it seems that the json parsing is not working.

Here is the output of the debug.

Tokens and unique codes are replaced with dummy strings.

lezoid@hostname:~$ carwings -debug -region NML -username hogehoge -password Dummy locate
Logging into Carwings...
POST https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/InitialApp_v2.php map[initial_app_str:[Dummy]]
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Date: Thu, 24 Sep 2020 09:38:26 GMT
Server: Apache
Strict-Transport-Security: max-age=15768000

45
{"status":200,"message":"success","baseprm":"dummyprm"}
0

Error loading session from /home/lezoid/.carwings-session: json: cannot unmarshal number into Go value of type string
POST https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/UserLoginRequest.php map[Password:[password==] RegionCode:[NML] UserId:[hogehoge] initial_app_str:[9s5rfKVuMrT03RtzajWNcA]]
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Date: Thu, 24 Sep 2020 09:38:26 GMT
Server: Apache
Strict-Transport-Security: max-age=15768000

45b
{"status":200,"EncAuthToken":"DummyToken","CustomerInfo":{"UserId":"hogehoge","Language":"ja-JP","Timezone":"Asia\/Tokyo","RegionCode":"NML","OwnerId":"000000000","EMailAddress":"dummy@dummy.com","Nickname":"hogehoge","Country":"JP","VehicleImage":"\/content\/language\/default\/images\/img\/ph_car.jpg","UserVehicleBoundDurationSec":"946771200","VehicleInfo":{"VIN":"ZE1-000000","DCMID":"000000000000","SIMID":"00000000000000F","NAVIID":"000000000000","EncryptedNAVIID":"FA000000000000000000000","MSN":"070000000000","LastVehicleLoginTime":"","UserVehicleBoundTime":"2018-12-16T02:47:57Z","LastDCMUseTime":"","custom_sessionid":"cusstomsessionid==","NonaviFlg":"false","CarName":"LEAF","CarImage":"carimg2.png"}},"UserInfoRevisionNo":"1","ngTapUpdatebtn":"300000","timeoutUpdateAnime":"300000","G1Lw":"5","G1Li":"2","G1Lt":"20","G1Uw":"15","G1Ui":"2","G1Ut":"20","G2Lw":"15","G2Li":"2","G2Lt":"20","G2Uw":"15","G2Ui":"2","G2Ut":"20","resultKey":""}
0

ERROR: vehicle info unavailable
joeshaw commented 4 years ago

Thank you for the debug output. This is yet another variation in how some vehicles are presented through the API at login. It looks like your vehicle information is provided in the CustomerInfo stanza of the JSON, whereas on mine there is a vehicleInfoList stanza and on others it is simply vehicleInfo.

I will attempt to fix it soon.

lezoid commented 4 years ago

Thank you for your reply! Does the JSON format of the Japanese model Leaf differ from the Western model? I'm curious.

Do you need JSON values for the other APIs in the Japanese Model Leaf? If necessary, I will give you the results I got by hitting the API directly.

joeshaw commented 3 years ago

I just pushed a fix for this, sorry about the delay.