Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to embed this into a flaskapp so it can be used with siri shortcuts? #64

Open
krushil1 opened this issue Dec 12, 2022 · 8 comments

Comments

@krushil1
Copy link

I was trying to add flask app to the current codebase, so I could use the Siri shortcuts to interact with my car but I needed some assistance. Can someone help me out?

@G-Two
Copy link
Owner

G-Two commented Dec 19, 2022

Yes, you should be able to use this package in a flask app. You'll need to make sure to deal with the 2FA on the initial login, but after that, it should be pretty straightforward. Is there a particular part you're having trouble with?

@krushil1
Copy link
Author

Thanks for getting back! I was having trouble setting up my flask app with this package where I can start my car and use the preset climate controls.

@krushil1
Copy link
Author

I am a little confused regarding how I can call the commands using the subarulink package inside the flask app. Should I use subarulink(lock) to lock the car?

@krushil1
Copy link
Author

I believe I got the commands working! I need assistance with storing the subarulink.cfg file in the root directory of the flask app so when I host it, its easier to access

@krushil1
Copy link
Author

Is it possible to edit the default path of the config file? I keep getting stuck with the config file path when deploying it to WayScript for hosting.

@G-Two
Copy link
Owner

G-Two commented Dec 20, 2022

I'm not too familiar with how WayScript (or even Flask) environments work. Can you paste in a snippet of your code that uses the subarulink module? If you're using subarulink.cfg, then I'm assuming you are invoking the example CLI app that comes with the module (since subarulink.controller itself has no concept of a config file). If you are calling the CLI app as a shell command, then you can specify a config file path with the -c option.

FYI, you can also use subarulink.controller directly without dealing with config files. There is an example using aws-lambda that doesn't use the CLI app and accesses your Subaru account information secrets via environment variables. The code is a bit dated from a previous version of subarulink, but it shows that you can have finer control instead of depending on the CLI app. Additional subarulink documentation is here.

@krushil1
Copy link
Author

Thanks for getting back! The way I had my flask app set up was that when I request a door command or engine command, it would use the subprocess module to run the CLI command for subarulink. I tried using the -c option to change the config file location, but that didn't work for me :/

I later checked out the repo with aws-lambda-function, I couldn't get the car to start, as it kept giving me a 500 error, but I did have success with using the door unlock/lock command. So I was thinking of using the subaru.controller to access all of my car's functionality. Can you please provide me with a sample file for subaru.controller where I can lock/unlock, start, and stop my car? It would be a great help as I am a rookie with python 😭

@csmarshall
Copy link

this works for me:
homebridge -> Homebridge Cmdtriggerswitch -> subarulink cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants