G-Two / subarulink

A python package for interacting with Subaru STARLINK remote vehicle services.
Apache License 2.0
89 stars 13 forks source link

International usage #4

Open Roemer opened 4 years ago

Roemer commented 4 years ago

I would be greatly interested in this but I am from Switzerland and MySubaru is only for the US I suppose. Is there any possibility without a MySubaru Account? What is it used for? I can help testing and debugging stuff. I have a 2019 Levorg Subaru.

stboch commented 4 years ago

@Roemer is there an equivalent app used for remote access in your country if so can you send in some of the links.

Roemer commented 4 years ago

What do you mean with "Remote Access"? All I have is the Subaru Starlink app or the Aha Radio app. Edit: Just saw some videos, that is pretty cool. Unfortunately here in Europe we don't get any of the stuff obviously, also we only have very limited eyesight settings compared to the US or Japan... I will keep my eyes open if that will come in the future.

stboch commented 4 years ago

Hopefully Subaru brings these features to Europe soon. The rules with data protection can make these choices difficult, and since most of these features roll out in new cars it might be years before they make it into the plans for the next model year. The 2021 Crosstrek might have some new technology but not sure best to ask a dealership.

lheures commented 3 years ago

I have a 2021 Crosstrek if there is anything I can do to help.

stboch commented 3 years ago

@lheures what country are you in and can you paste what the debug output is when you run the subarulink in debug mode? Also if your able to maybe send some of urls XHR to the api endpoints you get when visiting the site with chrome.

lheures commented 3 years ago

Canada, Ontario this is the standalone

2020-12-22 23:18:03,706 - subarulink - INFO - Entering interactive mode 2020-12-22 23:18:03,709 - subarulink - INFO - Opening config file: /home/steven/.subarulink.cfg 2020-12-22 23:18:03,729 - subarulink - INFO - Connecting to Subaru Remote Services API 2020-12-22 23:18:03,732 - subarulink.controller - DEBUG - Connecting controller to Subaru Remote Services 2020-12-22 23:18:03,733 - subarulink.connection - DEBUG - POST: https://mobileapi.prod.subarucs.com/g2v17/login.json, params=None, json_data=None 2020-12-22 23:18:04,159 - subarulink.connection - DEBUG - {'data': None, 'dataName': None, 'errorCode': 'invalidAccount', 'success': False} 2020-12-22 23:18:04,165 - subarulink - ERROR - Unable to connect: invalidAccount

urls XHR to the api endpoints you get when visiting the site with chrome. How to do this

stboch commented 3 years ago

F12 gets you into the developers console in Chrome. Then you should find the network tab. In the middle of that screen should be some filter choices on is XHR. This will limit the data to only api calls to the site. Then try to do something like blink the lights.

stboch commented 3 years ago

@G-Two ok found it looks like Canada uses a whole separate system and doesn't even forward users on but here is the ca url looks like they just added ca in the middle. "https://mobileapi.ca.prod.subarucs.com" not sure what other countries there are. Otherwise the CA app looks the same.

G-Two commented 3 years ago

@lheures I started a new branch to try to support Subaru Canada without imposing a subarulink API change. If it is just a url change then this should work. The standalone CLI program should prompt you for a country after you install the following pre-release version.

$ pip install subarulink==0.3.11.dev1

Please let me know if this works. Once we confirm it works, I'll add a config flow option for Home Assistant to select country.

lheures commented 3 years ago

@G-Two So basically that fixed things however I get this on remote start these were predefined settings from the app and website

remote_start show {'airConditionOn': 'false', 'climateSettings': 'climateSettings', 'climateZoneFrontAirMode': 'FEET_WINDOW', 'climateZoneFrontAirVolume': '7', 'climateZoneFrontTempCelsius': '29.0', 'heatedRearWindowActive': 'true', 'heatedSeatFrontLeft': 'OFF', 'heatedSeatFrontRight': 'OFF', 'outerAirCirculation': 'outsideAir', 'runTimeMinutes': '10', 'startConfiguration': 'START_ENGINE_ALLOW_KEY_IN_IGNITION'} remote_start on 2020-12-24 08:15:12,032 - subarulink - ERROR - SubaruException caught: Error with climate settings

Also even though I do have heated seats I do not see the heated seat functions in the app or web site. So if that setting works i'm even happier :) can't wait to try the HomeAssistant plugin now. Other features are working horn lights door lock/unlock I checked for changing from C to F in the app and web site with no success

So ran through the settings to set everything in F with interactive mode and now it starts not sure if the app or web site works after will test later

lheures commented 3 years ago

Yes so went back into the web site and the app and all my settings had changed so it is a difference between imperial and metric.

G-Two commented 3 years ago

@lheures yes, it also looks like _validate_remote_start_params() has some issues since it appears that some fields are optional (such as heatedRearWindowActive). The check appears to have failed when fetching and using your saved climate config because Subaru Canada uses a climateZoneFrontTempCelsius field, which my code wasn't expecting. Surprisingly it seems to accept the US climateZoneFrontTemp with implied imperial units. I'll fix the validation code, since it needed to be refactored anyway.

As for the heated seats, I have a 2019 Crosstrek with heated seats and have been unable to activate them remotely. I think this is only possible in the Outback and Ascent (maybe Forester). The Crosstrek has a mechanical rocker switch, where the other models have a push button switch (which I imagine can be signaled remotely). Kind of a bummer since it would be nice to have a warm seat waiting on cold days.

lheures commented 3 years ago

Ok looking forward to the update and the ability to use the Home Assistant plugin

G-Two commented 3 years ago

@lheures I've published a pre-release for the Home Assistant integration with Canada support. Please give it a try and let me know how it goes.

lheures commented 3 years ago

@G-Two Ok cloned it put in custom_components restarted and now its not showing up.

Logger: homeassistant.loader Source: loader.py:465 First occurred: 7:30:09 PM (1 occurrences) Last logged: 7:30:09 PM

You are using a custom integration for subaru which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

When I goto configuration integration and click add start typing subaru nothing appears

G-Two commented 3 years ago

@lheures you might need to refresh your browser or clear the cache to see the Subaru option.

lheures commented 3 years ago

@G-Two had to install HACS then add it that way. It loaded I picked the dev for the install. I selected CAN then the second window took some guessing but it was for my PIN. Now its installed i've restarted again just need to figure out how to use it with HA