nricklin/leafpy

Returned Data Format Changed?

Closed this issue · 3 comments

For NE region, returned JSON data has a slightly different format:
Change FROM:
custom_sessionid = r.json()['VehicleInfoList']['vehicleInfo'][0]['custom_sessionid']
TO:
custom_sessionid = r.json()['vehicleInfo'][0]['custom_sessionid']

Interesting. for the NNA region (which is basically hard coded here) r.json()['VehicleInfoList']['vehicleInfo'][0]['custom_sessionid'] is still correct.

Are you saying that if you set region to NE this fails?

Maybe I can make a pull request and you can try it out and see if it works? I don't have creds that work in the NE region

Ok I made a pull request on branch api_diff_region_NE.

Can you check it out & try

leaf = Leaf('<username>','<password>','NE')

and see if that works? Also I'm interested in whether all the data responses are also different.

Yes, the change works fine in the UK. Here is a selection of data responses:

############
Full login response
{
"CustomerInfo": {
"Country": "GB",
"EMailAddress": "",
"Language": "en_GB",
"Nickname": "Leaf",
"OwnerId": "",
"RegionCode": "NE",
"Timezone": "Europe/Paris",
"UserId": "",
"UserVehicleBoundDurationSec": "",
"VehicleImage": "/content/language/default/images/img/ph_car.jpg",
"VehicleInfo": {
"CarImage": "carimg6.png",
"CarName": "LEAF",
"DCMID": "",
"EncryptedNAVIID": "",
"LastDCMUseTime": "2019/02/17 17:18",
"LastVehicleLoginTime": "",
"MSN": "",
"NAVIID": "",
"NonaviFlg": "false",
"SIMID": "",
"UserVehicleBoundTime": "2018-09-07T14:44:35Z",
"VIN": ""
}
},
"EncAuthToken": "",
"UserInfoRevisionNo": "1",
"ngTapUpdatebtn": "300000",
"status": 200,
"timeoutUpdateAnime": "300000",
"vehicle": {
"profile": {
"dcmId": "",
"encAuthToken": "",
"gdcPassword": "",
"gdcUserId": "",
"nickname": "Leaf",
"status": "true",
"statusDate": "2018/08/29 22:00",
"vin": ""
}
},
"vehicleInfo": [
{
"charger20066": "false",
"custom_sessionid": "==",
"nickname": "Leaf",
"telematicsEnabled": "true",
"vin": ""
}
]
}

############
Command: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusRecordsRequest.php
{
"BatteryStatusRecords": {
"BatteryStatus": {
"BatteryCapacity": "12",
"BatteryChargingStatus": "NORMAL_CHARGING",
"BatteryRemainingAmount": "12",
"BatteryRemainingAmountWH": "",
"BatteryRemainingAmountkWH": ""
},
"CruisingRangeAcOff": "142568.0",
"CruisingRangeAcOn": "142568.0",
"NotificationDateAndTime": "2019/02/17 17:18",
"OperationDateAndTime": "2019/02/17 17:18",
"OperationResult": "START",
"PluginState": "CONNECTED",
"TargetDate": "2019/02/17 17:18",
"TimeRequiredToFull200_6kW": {
"HourRequiredToFull": "0",
"MinutesRequiredToFull": "40"
}
},
"status": 200
}

########
Command: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusCheckRequest.php
Command: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusCheckResultRequest.php
{
"batteryCapacity": "12",
"batteryDegradation": "12",
"chargeMode": "220V",
"chargeStatus": "CT",
"charging": "YES",
"cruisingRangeAcOff": "142568.0",
"cruisingRangeAcOn": "142568.0",
"currentChargeLevel": "0",
"operationResult": "START",
"pluginState": "CONNECTED",
"responseFlag": "1",
"status": 200,
"timeRequiredToFull": {
"hours": "",
"minutes": ""
},
"timeRequiredToFull200": {
"hours": "",
"minutes": ""
},
"timeRequiredToFull200_6kW": {
"hours": "0",
"minutes": "40"
},
"timeStamp": "2019-02-17 17:49:55"
}

##########
Command: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryRemoteChargingRequest.php
{'status': 200}