Closed Geezus42 closed 3 years ago
@Geezus42 can you provide some of the output when you run with -v2
I was working on that but as I'm looking at the output I think it may just have to do with only having recently gotten the vehicle and it not being fully transferred. I will close this and re-open it once I am able to talk to my agent and make sure everything is done.
Make sure you have upgraded to "Starlink Security Plus". The lower level, "safety plus" doesn't have access to all the actions and resulted in this error for me
If it is the lower safety plus please provide the output of the features list so we can better handle the error.
Here you go. I think it is showing multiple vehicle entries because it is pulling info from the leasing company's profile. Hopefully I sanitized everything correctly. I do just have the STARLINK® Safety Plus plan right now.
$ subarulink -i -v 2
2020-07-23 10:32:55,318 - subarulink - INFO - Entering interactive mode
2020-07-23 10:32:55,320 - subarulink - INFO - Opening config file: /home/geezus/.subarulink.cfg
2020-07-23 10:32:55,328 - subarulink - INFO - Connecting to Subaru Remote Services API
2020-07-23 10:32:55,328 - subarulink.controller - DEBUG - Connecting controller to Subaru Remote Services
2020-07-23 10:32:55,329 - subarulink.connection - DEBUG - POST: https://mobileapi.prod.subarucs.com/g2v15/login.json
2020-07-23 10:32:55,920 - subarulink.connection - DEBUG - Client authentication successful
2020-07-23 10:32:55,923 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': '',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': False,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': None,
'firstName': None,
'lastName': None,
'oemCustId': None,
'phone': None,
'sessionCustomer': None,
'zip': None},
'email': None,
'engineSize': None,
'extDescrip': None,
'features': None,
'firstName': None,
'intDescrip': None,
'lastName': None,
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': None,
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': None,
'subscriptionPlans': [],
'subscriptionStatus': None,
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': None}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-23 10:32:55,929 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/refreshVehicles.json
2020-07-23 10:32:56,756 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': ' ',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': True,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': '',
'firstName': ' ',
'lastName': '',
'oemCustId': '',
'phone': '',
'sessionCustomer': {'address': ' '
' '
'',
'address2': '',
'cellularPhone': '',
'city': ''
'',
'countryCode': '',
'createMysAccount': None,
'dealerCode': None,
'email': '',
'firstName': ' '
'',
'gender': '',
'homePhone': '',
'lastName': '',
'oemCustId': '',
'phone': '',
'primaryPersonalCountry': '',
'relationshipType': None,
'sourceSystemCode': 'mys',
'state': '',
'suffix': '',
'title': '',
'vehicles': [{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Non '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': True,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Previous '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''}],
'workPhone': '',
'zip': '-',
'zip5Digits': ''},
'zip': '-'},
'email': '',
'engineSize': None,
'extDescrip': None,
'features': ['RESCC',
'WASH_MIL',
'RES',
'OPL_MIL',
'EOL_MIL',
'VDC_MIL',
'ABS_MIL',
'TEL_MIL',
'BSD',
'EBD_MIL',
'ESS_MIL',
'EYESIGHT',
'SRS_MIL',
'CEL_MIL',
'EPAS_MIL',
'TPMS_MIL',
'BSDRCT_MIL',
'AWD_MIL',
'ISS_MIL',
'ATF_MIL',
'RCC',
'ACCS',
'g2'],
'firstName': ' ',
'intDescrip': None,
'lastName': '',
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': '',
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': ['SAFETY', 'Retail'],
'subscriptionPlans': [],
'subscriptionStatus': 'ACTIVE',
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': '-'}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-23 10:32:56,782 - subarulink.controller - DEBUG - Subaru Remote Services Ready!
2020-07-23 10:32:56,782 - subarulink - INFO - Successfully connected
Available Vehicles:
[1] ()
2020-07-23 10:32:56,783 - subarulink.controller - DEBUG - Getting EV Status :False
2020-07-23 10:32:56,783 - subarulink.controller - DEBUG - Getting RES Status :True
2020-07-23 10:32:56,783 - subarulink - INFO - Fetching data for ...
2020-07-23 10:32:56,784 - subarulink.controller - DEBUG - Fetching vehicle status from Subaru
2020-07-23 10:32:56,784 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/validateSession.json
2020-07-23 10:32:56,840 - subarulink.connection - DEBUG - {'data': None, 'dataName': None, 'errorCode': None, 'success': True}
2020-07-23 10:32:56,840 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json
2020-07-23 10:32:56,914 - subarulink.connection - DEBUG - RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json'), method='GET', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.191030.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36', 'Origin': 'file://', 'X-Requested-With': 'com.subaru.telematics.app.remote', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Cookie': 'JSESSIONID=; ORA_OTD_JROUTE=0t-ZDpuqZ8Kd9fOPUgWG3z-Lj7lLqZqf')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json'))
2020-07-23 10:32:56,915 - subarulink.connection - DEBUG - {'errorCode': 'error',
'errorMessage': 'java.lang.NullPointerException - null',
'httpCode': 500}
2020-07-23 10:32:56,915 - subarulink - ERROR - Unable to connect. Check Username/Password.
@Geezus42 thanks for the logs. It looks like we should look for 'REMOTE' in 'subscriptionFeatures' to determine if the vehicle is subscribed to Security Plus. I'll add this check in the future to raise an exception that an application can use to inform the user.
So is it just the API that requires Security Plus? Because I can log into the MySubaru app and see a lot of this information.
@G-Two looking at the Android app it looks like this might be another time where vehiclestatus.json might be the option. It seems that condition execute Is only supported on Remote packages. @Geezus42 not quite but most of the supported commands need the security package we trigger a different command that gets the cars current status which looks to only be supported when you have purchased the security tier.
@stboch I agree, using vehicleStatus.json looks like the right strategy to support more users. The data is more reliable from that API call as well. I have it working locally on my machine now. I'll push an update as soon as I make some adjustments so I don't have to make changes to the Home Assistant integration.
@Geezus42 thanks for bringing up the issue. I hope to have it working for you shortly.
I'll probably upgrade once all the paperwork is done but I'm glad I could point out something to make it more useful for others.
Fix commited to the repo. Let me know if it works and I'll push to PyPI as new release 0.3.4.
@G-Two Tested with the 2019 Ascent and the 2020 outback both worked, I noticed you removed the invalid status handler, is the thought to have this accomplished by the HA code? Also not sure if you meant this but there is two different formats for tire pressure.
Still didn't work.
Available Vehicles:
[1] ()
2020-07-28 14:31:49,082 - subarulink.controller - DEBUG - Getting EV Status :False
2020-07-28 14:31:49,083 - subarulink.controller - DEBUG - Getting RES Status :True
2020-07-28 14:31:49,083 - subarulink - INFO - Fetching data for ...
2020-07-28 14:31:49,083 - subarulink.controller - DEBUG - Fetching vehicle status from Subaru
2020-07-28 14:31:49,084 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/validateSession.json
2020-07-28 14:31:49,143 - subarulink.connection - DEBUG - {'data': None, 'dataName': None, 'errorCode': None, 'success': True}
2020-07-28 14:31:49,143 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json
2020-07-28 14:31:49,201 - subarulink.connection - DEBUG - RequestInfo(url=URL('https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json'), method='GET', headers=<CIMultiDictProxy('Host': 'mobileapi.prod.subarucs.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Android SDK built for x86 Build/QSR1.191030.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.185 Mobile Safari/537.36', 'Origin': 'file://', 'X-Requested-With': 'com.subaru.telematics.app.remote', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Cookie': 'JSESSIONID=; ORA_OTD_JROUTE=0t-ZDpuqZ8Kd9fOPUgWG3z-Lj7lLqZqf')>, real_url=URL('https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json'))
2020-07-28 14:31:49,202 - subarulink.connection - DEBUG - {'errorCode': 'error',
'errorMessage': 'java.lang.NullPointerException - null',
'httpCode': 500}
2020-07-28 14:31:49,203 - subarulink - ERROR - Unable to connect. Check Username/Password.
I can provide the full -v2 output if needed.
@Geezus42 did you download the code from the GitHub or just an pip upgrade? The debug looks like the old code that's why I ask.
I just ran pip upgrade. I thought you had already pushed it.
@Geezus42 I just pushed a release candidate to PyPI. Give this a try: pip install subarulink==0.3.4rc0
@G-Two Just gave 0.3.4rc0 a try with HA, everything looks ok so far.
$ pip install subarulink==0.3.4rc0 Collecting subarulink==0.3.4rc0 Could not find a version that satisfies the requirement subarulink==0.3.4rc0 (from versions: ) No matching distribution found for subarulink==0.3.4rc0
Try it with ' pip install 'subarulink==0.3.4rc0'
If it's already installed might also need to throw in --upgrade
I just tried cloning the repo and running it but it won't pickup my existing cfg even with the -c flag but that might be a WSL issue since I don't have a dedicated Linux machine to test on right now.
pip3 install --upgrade subarulink==0.3.4rc0
worked
New version authenticates, I can see my odometer reading. Issue resolved.
@Geezus42 thanks for testing. Would you please paste in your -v2 debug logs for when the application calls vehicleStatus.json? I'd like to know what information the Subaru API passes along for a Safety Plus subscription and make sure that I put proper checks in on the Home Assistant integration to ensure all the available data is being used. Example:
2020-07-29 09:15:05,205 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/vehicleStatus.json
2020-07-29 09:15:05,284 - subarulink.controller - DEBUG - {
"data": {
"avgFuelConsumptionLitersPer100Kilometers": 2.3,
"avgFuelConsumptionMpg": 102.2,
"distanceToEmptyFuelKilometers": 707,
"distanceToEmptyFuelKilometers10s": 710,
"distanceToEmptyFuelMiles": 439.31,
"distanceToEmptyFuelMiles10s": 440,
"eventDate": 1595547303000,
"eventDateStr": "2020-07-23T23:35+0000",
"latitude": 90.0,
"longitude": 180.0,
"odometerValue": 3694,
"odometerValueKilometers": 5944,
"positionHeadingDegree": 170,
"vehicleStateType": "IGNITION_OFF",
"vhsId": 1722793258,
},
"dataName": None,
"errorCode": None,
"success": True,
}
@G-Two Tested with the 2019 Ascent and the 2020 outback both worked, I noticed you removed the invalid status handler, is the thought to have this accomplished by the HA code? Also not sure if you meant this but there is two different formats for tire pressure.
@stboch the invalid status handler was there previously because of how unreliable certain data fields were when fetched via https://mobileapi.prod.subarucs.com/g2v15/service/g2/condition/execute.json. Now that we're using vehicleStatus.json first, we discard the error prone fields from the latter API call. I'll probably just keep the tire pressures metric to be consistent since the Subarus seem to do everything metric natively. Home Assistant has good support for conversions, so I'll let it handle those. It also looks like fuel economy is off by 10x, so I'll fix that.
$ subarulink -i -v 2
2020-07-29 08:31:53,849 - subarulink - INFO - Entering interactive mode
2020-07-29 08:31:53,849 - subarulink - INFO - Opening config file: /home/geezus/.subarulink.cfg
2020-07-29 08:31:53,852 - subarulink - INFO - Connecting to Subaru Remote Services API
2020-07-29 08:31:53,852 - subarulink.controller - DEBUG - Connecting controller to Subaru Remote Services
2020-07-29 08:31:53,852 - subarulink.connection - DEBUG - POST: https://mobileapi.prod.subarucs.com/g2v15/login.json
2020-07-29 08:31:54,300 - subarulink.connection - DEBUG - Client authentication successful
2020-07-29 08:31:54,303 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': '',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': False,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': None,
'firstName': None,
'lastName': None,
'oemCustId': None,
'phone': None,
'sessionCustomer': None,
'zip': None},
'email': None,
'engineSize': None,
'extDescrip': None,
'features': None,
'firstName': None,
'intDescrip': None,
'lastName': None,
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': None,
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': None,
'subscriptionPlans': [],
'subscriptionStatus': None,
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': None}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-29 08:31:54,312 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/refreshVehicles.json
2020-07-29 08:31:55,034 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': ' ',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': True,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': '',
'firstName': ' ',
'lastName': '',
'oemCustId': '',
'phone': '',
'sessionCustomer': {'address': ' '
' '
'',
'address2': '',
'cellularPhone': '',
'city': ''
'',
'countryCode': 'USA',
'createMysAccount': None,
'dealerCode': None,
'email': '',
'firstName': ' '
'',
'gender': '',
'homePhone': '',
'lastName': '',
'oemCustId': '',
'phone': '',
'primaryPersonalCountry': 'USA',
'relationshipType': None,
'sourceSystemCode': 'mys',
'state': '',
'suffix': '',
'title': '',
'vehicles': [{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Non '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': True,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Previous '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''}],
'workPhone': '',
'zip': '-',
'zip5Digits': ''},
'zip': '-'},
'email': '',
'engineSize': None,
'extDescrip': None,
'features': ['RESCC',
'WASH_MIL',
'RES',
'OPL_MIL',
'EOL_MIL',
'VDC_MIL',
'ABS_MIL',
'TEL_MIL',
'BSD',
'EBD_MIL',
'ESS_MIL',
'EYESIGHT',
'SRS_MIL',
'CEL_MIL',
'EPAS_MIL',
'TPMS_MIL',
'BSDRCT_MIL',
'AWD_MIL',
'ISS_MIL',
'ATF_MIL',
'RCC',
'ACCS',
'g2'],
'firstName': ' ',
'intDescrip': None,
'lastName': '',
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': '',
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': ['SAFETY', 'Retail'],
'subscriptionPlans': [],
'subscriptionStatus': 'ACTIVE',
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': '-'}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-29 08:31:55,062 - subarulink.controller - DEBUG - Subaru Remote Services Ready!
2020-07-29 08:31:55,062 - subarulink - INFO - Successfully connected
Available Vehicles:
[1] ()
2020-07-29 08:31:55,062 - subarulink.controller - DEBUG - Getting EV Status :False
2020-07-29 08:31:55,063 - subarulink.controller - DEBUG - Getting RES Status :True
2020-07-29 08:31:55,063 - subarulink - INFO - Fetching data for ...
2020-07-29 08:31:55,063 - subarulink.controller - DEBUG - Getting Safety Plus Status :True
2020-07-29 08:31:55,063 - subarulink.controller - DEBUG - Fetching vehicle status from Subaru
2020-07-29 08:31:55,063 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/validateSession.json
2020-07-29 08:31:55,120 - subarulink.connection - DEBUG - {'data': None, 'dataName': None, 'errorCode': None, 'success': True}
2020-07-29 08:31:55,120 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/vehicleStatus.json
2020-07-29 08:31:55,195 - subarulink.controller - DEBUG - {'data': {'avgFuelConsumptionLitersPer100Kilometers': 11.3,
'avgFuelConsumptionMpg': 20.8,
'distanceToEmptyFuelKilometers': 675,
'distanceToEmptyFuelKilometers10s': 680,
'distanceToEmptyFuelMiles': 419.43,
'distanceToEmptyFuelMiles10s': 420,
'evDistanceToEmptyByStateKilometers': None,
'evDistanceToEmptyByStateMiles': None,
'evDistanceToEmptyKilometers': None,
'evDistanceToEmptyMiles': None,
'evStateOfChargePercent': None,
'eventDate': 1596023569000,
'eventDateStr': '2020-07-29T11:52+0000',
'latitude': ,
'longitude': -,
'odometerValue': 290,
'odometerValueKilometers': 467,
'positionHeadingDegree': '123',
'tirePressureFrontLeft': '1999',
'tirePressureFrontLeftPsi': '28.99',
'tirePressureFrontRight': '1861',
'tirePressureFrontRightPsi': '26.99',
'tirePressureRearLeft': '1999',
'tirePressureRearLeftPsi': '28.99',
'tirePressureRearRight': '1930',
'tirePressureRearRightPsi': '27.99',
'vehicleStateType': 'IGNITION_OFF',
'vhsId': },
'dataName': None,
'errorCode': None,
'success': True}
2020-07-29 08:31:55,201 - subarulink.controller - DEBUG - Getting remote Status :False
Vehicle last reported data 0 days, 1 hours, 39 minutes ago
Odometer: 290.2 miles
Traceback (most recent call last):
File "/home/geezus/.local/bin/subarulink", line 10, in <module>
sys.exit(main())
File "/home/geezus/.local/lib/python3.7/site-packages/subarulink/app/cli.py", line 557, in main
LOOP.run_until_complete(cli.run())
File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "/home/geezus/.local/lib/python3.7/site-packages/subarulink/app/cli.py", line 404, in run
if await self._connect():
File "/home/geezus/.local/lib/python3.7/site-packages/subarulink/app/cli.py", line 302, in _connect
self._show(["summary"])
File "/home/geezus/.local/lib/python3.7/site-packages/subarulink/app/cli.py", line 284, in _show
print("External Temp: %0.1f °F" % _c_to_f(self._car_data["status"][sc.EXTERNAL_TEMP]))
KeyError: 'EXT_EXTERNAL_TEMP'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f45c8061350>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f45c808a6e0>, 6.831773)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f45c977f910>
Only problem is the stats there are about whereas the ones reported using the status command are off, especially the avg fuel consumption. Also, it does give the correct lat/long I just removed them for obvious reasons.
$ subarulink status
{'status': {'AVG_FUEL_CONSUMPTION': 11.3,
'DISTANCE_TO_EMPTY_FUEL': 675,
'ODOMETER': 467000,
'TIMESTAMP': 1596023569.0,
'VEHICLE_STATE_TYPE': 'IGNITION_OFF',
'heading': '123',
'latitude': ,
'longitude': -}}
@Geezus42 please give subarulink==0.3.4.rc1
a try. It should fix the KeyError as well as display more data to you with US units.
@stboch this might break some unit conversions in Home Assistant. I'll update the PR once I have this package release stable.
Interactive mode works now and I see why the fuel consumption was off when using the status command. Status just show LPK where the verbose output shows LPK and MPG. I put the output of both below.
$ subarulink -i -v 2
2020-07-29 09:36:32,732 - subarulink - INFO - Entering interactive mode
2020-07-29 09:36:32,732 - subarulink - INFO - Opening config file: /home/geezus/.subarulink.cfg
2020-07-29 09:36:32,734 - subarulink - INFO - Connecting to Subaru Remote Services API
2020-07-29 09:36:32,735 - subarulink.controller - DEBUG - Connecting controller to Subaru Remote Services
2020-07-29 09:36:32,735 - subarulink.connection - DEBUG - POST: https://mobileapi.prod.subarucs.com/g2v15/login.json
2020-07-29 09:36:33,141 - subarulink.connection - DEBUG - Client authentication successful
2020-07-29 09:36:33,142 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': '',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': False,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': None,
'firstName': None,
'lastName': None,
'oemCustId': None,
'phone': None,
'sessionCustomer': None,
'zip': None},
'email': None,
'engineSize': None,
'extDescrip': None,
'features': None,
'firstName': None,
'intDescrip': None,
'lastName': None,
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': None,
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': None,
'subscriptionPlans': [],
'subscriptionStatus': None,
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': None}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-29 09:36:33,152 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/refreshVehicles.json
2020-07-29 09:36:33,878 - subarulink.connection - DEBUG - {'data': {'account': {'accountKey': ,
'createdDate': ,
'firstName': ' ',
'lastLoginDate': ,
'lastName': '',
'marketId': 1,
'zipCode': '',
'zipCode5': ''},
'currentVehicleIndex': 0,
'deviceId': '',
'deviceRegistered': True,
'digitalGlobeConnectId': '',
'digitalGlobeImageTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe:ImageryTileService@EPSG:3857@png/{z}/{x}/{y}.png?connectId=',
'digitalGlobeTransparentTileService': 'https://earthwatch.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/Digitalglobe:OSMTransparentTMSTileService@EPSG:3857@png/{z}/{x}/{-y}.png/?connectId=',
'enableXtime': True,
'handoffToken': '',
'passwordToken': None,
'resetPassword': False,
'satelliteViewEnabled': False,
'sessionChanged': True,
'sessionId': '',
'termsAndConditionsAccepted': True,
'tomtomKey': '',
'vehicleInactivated': False,
'vehicles': [{'accessLevel': -1,
'active': True,
'authorizedVehicle': False,
'cachedStateCode': '',
'customer': {'email': '',
'firstName': ' ',
'lastName': '',
'oemCustId': '',
'phone': '',
'sessionCustomer': {'address': ' '
' '
'',
'address2': '',
'cellularPhone': '',
'city': ' '
'',
'countryCode': 'USA',
'createMysAccount': None,
'dealerCode': None,
'email': '@',
'firstName': ' '
'',
'gender': '',
'homePhone': '',
'lastName': '',
'oemCustId': '',
'phone': '',
'primaryPersonalCountry': 'USA',
'relationshipType': None,
'sourceSystemCode': '',
'state': '',
'suffix': '',
'title': '',
'vehicles': [{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Non '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Inactive',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': True,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'Previous '
'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''},
{'oemCustId': '',
'primary': False,
'siebelVehicleRelationship': 'TM '
'Subscriber',
'status': 'Active',
'vin': ''}],
'workPhone': '',
'zip': '-',
'zip5Digits': ''},
'zip': '-'},
'email': '@',
'engineSize': None,
'extDescrip': None,
'features': ['RESCC',
'WASH_MIL',
'RES',
'OPL_MIL',
'EOL_MIL',
'VDC_MIL',
'ABS_MIL',
'TEL_MIL',
'BSD',
'EBD_MIL',
'ESS_MIL',
'EYESIGHT',
'SRS_MIL',
'CEL_MIL',
'EPAS_MIL',
'TPMS_MIL',
'BSDRCT_MIL',
'AWD_MIL',
'ISS_MIL',
'ATF_MIL',
'RCC',
'ACCS',
'g2'],
'firstName': ' ',
'intDescrip': None,
'lastName': '',
'licensePlate': '',
'licensePlateState': '',
'mileageCalculated': None,
'mileageEstimate': None,
'modelName': None,
'modelYear': None,
'needEmergencyContactPrompt': False,
'needMileagePrompt': False,
'nickname': '',
'oemCustId': '',
'phev': None,
'phone': '',
'preferredDealer': None,
'provisioned': True,
'remoteServicePinExist': True,
'stolenVehicle': False,
'subscriptionFeatures': ['SAFETY', 'Retail'],
'subscriptionPlans': [],
'subscriptionStatus': 'ACTIVE',
'timeZone': 'America/Chicago',
'transCode': None,
'userOemCustId': '',
'vehicleGeoPosition': None,
'vehicleKey': ,
'vehicleName': '',
'vin': '',
'zip': '-'}]},
'dataName': 'sessionData',
'errorCode': None,
'success': True}
2020-07-29 09:36:33,900 - subarulink.controller - DEBUG - Subaru Remote Services Ready!
2020-07-29 09:36:33,900 - subarulink - INFO - Successfully connected
Available Vehicles:
[1] ()
2020-07-29 09:36:33,901 - subarulink.controller - DEBUG - Getting EV Status :False
2020-07-29 09:36:33,901 - subarulink.controller - DEBUG - Getting RES Status :True
2020-07-29 09:36:33,901 - subarulink.controller - DEBUG - Getting remote Status :False
2020-07-29 09:36:33,901 - subarulink - INFO - Fetching data for ...
2020-07-29 09:36:33,901 - subarulink.controller - DEBUG - Getting Safety Plus Status :True
2020-07-29 09:36:33,901 - subarulink.controller - DEBUG - Fetching vehicle status from Subaru
2020-07-29 09:36:33,902 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/validateSession.json
2020-07-29 09:36:33,959 - subarulink.connection - DEBUG - {'data': None, 'dataName': None, 'errorCode': None, 'success': True}
2020-07-29 09:36:33,959 - subarulink.connection - DEBUG - GET: https://mobileapi.prod.subarucs.com/g2v15/vehicleStatus.json
2020-07-29 09:36:34,021 - subarulink.controller - DEBUG - {'data': {'avgFuelConsumptionLitersPer100Kilometers': 11.3,
'avgFuelConsumptionMpg': 20.8,
'distanceToEmptyFuelKilometers': 675,
'distanceToEmptyFuelKilometers10s': 680,
'distanceToEmptyFuelMiles': 419.43,
'distanceToEmptyFuelMiles10s': 420,
'evDistanceToEmptyByStateKilometers': None,
'evDistanceToEmptyByStateMiles': None,
'evDistanceToEmptyKilometers': None,
'evDistanceToEmptyMiles': None,
'evStateOfChargePercent': None,
'eventDate': 1596023569000,
'eventDateStr': '2020-07-29T11:52+0000',
'latitude': ,
'longitude': ,
'odometerValue': 290,
'odometerValueKilometers': 467,
'positionHeadingDegree': '123',
'tirePressureFrontLeft': '1999',
'tirePressureFrontLeftPsi': '28.99',
'tirePressureFrontRight': '1861',
'tirePressureFrontRightPsi': '26.99',
'tirePressureRearLeft': '1999',
'tirePressureRearLeftPsi': '28.99',
'tirePressureRearRight': '1930',
'tirePressureRearRightPsi': '27.99',
'vehicleStateType': 'IGNITION_OFF',
'vhsId': },
'dataName': None,
'errorCode': None,
'success': True}
2020-07-29 09:36:34,027 - subarulink.controller - DEBUG - Getting remote Status :False
Vehicle last reported data 0 days, 2 hours, 43 minutes ago
Odometer: 290.2 miles
Distance to Empty: 419 miles
Average Fuel Consumption: 20 MPG
Position: °N °W Heading: 123
Vehicle State: IGNITION_OFF
Tire Pressures (psi):
FL: 28 FR: 26
RL: 28 RR: 27
Enter a command. For a list of commands, enter '?'.
> ?
$ subarulink status
{'status': {'AVG_FUEL_CONSUMPTION': 11.3,
'DISTANCE_TO_EMPTY_FUEL': 675,
'ODOMETER': 467,
'TIMESTAMP': 1596023569.0,
'TYRE_PRESSURE_FRONT_LEFT': 1999,
'TYRE_PRESSURE_FRONT_RIGHT': 1861,
'TYRE_PRESSURE_REAR_LEFT': 1999,
'TYRE_PRESSURE_REAR_RIGHT': 1930,
'VEHICLE_STATE_TYPE': 'IGNITION_OFF',
'heading': '123',
'latitude': .,
'longitude': -}}
Command 'status' completed for
Thats the current intended behavior. Measurements are maintained in metric format since that is what the vehicle reports, and it is up the application using the data to convert. In Home Assistant, the global configuration setting for metric or imperial will automatically direct the subaru integration to convert to the user desired units.
Using 0.3.10 and getting invalid account however I can sign into the mysubaru.ca site
When I run the command it displays my vehicle's VIN under available vehicles but then says it is unable to connect.
$ subarulink -i
Available Vehicles: [1] ############### (##################) 2020-07-19 20:37:48,346 - subarulink - ERROR - Unable to connect. Check Username/Password.