MySubaru app

Thanks. The python is easier to read, but having some issues getting some of the basics to work. Might need to call it a night / morning and look at it some more over the weekend.

That said, it does seem to have an additional step in the login, so it may come in handy.

You can get all the gas you want... if you are extraordinarily wealthy. That is especially the case in California.

1 Like

this would be amazing, i just know nothing.. 2021 Outback.

1 Like

I'd be interested to see if anyone can get the login process to work with this early version of a driver (logging in is literally all I have attempted to develop at this stage):

https://raw.githubusercontent.com/sburke781/hubitat/mySubaru/mySubaru/mySubaruParent_Driver.groovy

If you know how to install drivers code manually, add this driver and create a virtual device.
On the device edit page that is displayed, select the "platform", i.e. US or Canada. Set your username, password and PIN. Turn on Debug Logging. Click Save Preferences.

Keep the device page open and open a separate tab / window with the logs page for HE. On the device page click the "Refresh" command at the top. Keep an eye on the logs and you should eventually see something like this, but hopefully with a better outcome:
login: [success:false, errorCode:invalidAccount, dataName:null, data:null]

Thanks,
Simon

Simon,

Thanks for the start in this. Looks like just as you posted, with the logs shows as null.

dev:3592022-05-22 11:59:36.518 pm debuglogin: [success:false, errorCode:invalidAccount, dataName:null, data:null]

dev:3592022-05-22 11:59:36.323 pm debugsetRequestSource: Platform provided = USA, alternateSource = null

dev:3592022-05-22 11:59:36.321 pm debugsetAPIVersion: Platform provided = USA, alternateVersion = null

dev:3592022-05-22 11:59:36.318 pm debugsetBaseURL: Platform provided = USA, alternateURL = null

dev:3592022-05-22 11:59:36.307 pm debuglogin: login process called

Hmmm... that's a shame, but thanks for trying and letting me know. Was a bit of a long shot.

I can keep looking at it, but will probably be a couple of weeks before I do. If anyone's handy with Postman or something similar to capture the web traffic when using a browser, I'd be interested to know the calls that are being made when logging into the Subaru page.

Thanks,
Simon

I wish I could be of more help but I wouldn't even know where to begin. I can keep testing if needed and only if you have time to work on this.
Appreciate the effort thus far.

1 Like

From the peanut gallery looking at the python vs. what is sent in the driver, I'd cut the login JSON down to just the username and password. Looks like you're sending:

 body:{"env": "cloudprod", "loginUsername": "dummy@email.com", "password": "asbsbdiwqwe93e33e1e12e1", "deviceId": null, "passwordToken": null, "selectedVin": null, "pushToken": null, "deviceType": "android"}]

when it's expecting:

body: {"username":"dummy@email.com", "password":"asbsbdiwqwe93e33e1e12e1"}

Also note username not loginUserName.

Which python script are you looking at? In the original two that the were posted, the simpler second example is not what we are after (I believe), I was only ever seeing html returned, and it appears to be about 3 years old. The first "subarulink" example is the home assistant plugin and much more recently maintained. That said, it may be worth a try ... I could do that in the next few days ...

Looked at two to make sure you weren't looking at a newer version.

https://raw.githubusercontent.com/alex-savin/mysubaru/master/mysubaru.go

httpClient.R().SetFormData(map[string]string{"username": viper.GetString("credentials.username"), "password": viper.GetString("credentials.password")}).Post("/login")
	resp, _ := httpClient.R().SetQueryString("now=" + timestamp()).Get("/profile/getSecurityQuestion.json")

and the one in the third post (the simple one).

I suspect the go example is trying to replicate logging in via the web page, rather than making the direct API calls, but I can play with it to see if I can make it work.....

The confusing thing was the simpler one is written as though it gets JSON returned, but I could not get that at all

Looks it may then need to respond to a security question but if you get it to give you that you're almost there. Have fun.

1 Like

The security question sounds like it is the pin. I did enter that during the initial device setup.

1 Like

I noticed Subaru does require MFA (SMS or email) when logging in from a new device. I assume an API connection does not... cause if it did that would be really counterproductive. And when I was testing it never triggered any sort of message.

Yeah, normally, from the few API's I've worked with, this is handled slightly differently for applications wanting to maintain secure comm's with a cloud service like this. One of the examples seem to suggest some interaction with this, but I'd like to think it's not the solution we are looking for.

I'll see what I can find out about the HA integration and see how that relates to people's use of the app here.

Can people just confirm the name of the site / mobile app they are using?

mysubaru.com and this app:

3 Likes

So, there is a video out that shows steps to use Google Assistant using the first link.
It's a lengthy video, and they are running it on Python on a Windows machine.

YouTube Video

https://www.youtube.com/watch?v=xjDp5Egex5U

The process uses Google to trigger IFTTT, which then triggers push bullet, which then triggers push to run. Push to run will then activate a batch file that has been configured for each command (Lock, Unlock, Start, Engine Off, etc)

I believe the built in Home Assistant version may be more likely to be able to be integrated. However, they have limitations on what commands can be issued. (Going from memory..... {Corrected} Only Lock/Unlock are currently options. You still cannot remote start/stop the engine from Home Assistant)

Can Python be run directly from HE? If so, does it have the capability to save and run bat files to send the commands needed?

I haven't watched the whole video, but one thing that does spring to mind is, if you have a PC that is always on, would be to use EventGhost running on the PC, calling the local Python / bat scripts. I use EventGhost for a couple of things myself, so it can be done, including running a bat file on my PC.

If you don't have a PC that is always on or that you are happy to use to host this setup, then I probably need to take another look at the driver code I wrote and see if I can get it to work, or open it up to others to test. I'll see what I can come up with in the next couple of weeks, if you don't want to go down the PC path.

I have a few PC's. They stay on. But the way windows does updates, I would not rely on them for anything crucial. For home automaton, I prefer the reliability of the Raspberry Pi.

Popping on to revive this thread.

I have this working on Home Assistant running in Docker, and using helper toggles pulled in through Home Assistant Device Bridge, I run automations on home assistant to remotely start my car. So there is a solution for pulling this into HE now. (By the way, the home assistant is phenominal with nearly EVERY attribute being available)

The built in subaru integration on HA does not have remote start and stop capability. It requires custom integration on HA. Directions are on the readme. It was easy enough for a two day on HA person like myself to do though.

If anyone wants to make a go of converting it to HE, the code link is below. But, just a few switches(Helper Toggles) and HE does everything I want. The rest I go into HA for.

*** Edited to add - This is NOT MY CODE. I just found it. ***

2 Likes