MySubaru app

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