prefect
is a Python library for interacting with your MyFordMobile-enabled vehicle. With prefect
, you can:
- Lock your car
- Unlock your car
- Check your gas level, and, if you have one, your EV battery level
- Start your engine (e.g. to preheat your car in the Blustery Times Of Year), and stop your engine if you decide to stay home after all
prefect
uses a reverse-engineered API, and may be unstable. DON'T PANIC.
Example | Description |
---|---|
AWS Lambda | Start your car with ford-prefect from an AWS Lambda |
🚧 HomeAssistant | Start/stop, lock/unlock your car with Home Assistant |
pip3 install -U ford-prefect
from prefect import FordAPI
F = FordAPI()
F.authenticate(USERNAME, PASSWORD)
F.get_vehicles() # returns a list of dicts with metadata
my_car = F.get_vehicles()[0]
my_car.start_engine()
print(my_car.status()) # metadata dictionary
There are three ways to authenticate:
You can pass credentials directly into the authenticate
call:
F.authenticate(USERNAME, PASSWORD)
You can set PREFECT_USERNAME
and PREFECT_PASSWORD
environment variables. If these are set, pass nothing to the FordAPI#authenticate
call and they will be automatically detected.
You can store credentials in a JSON config file, and pass the filename into the authenticate
call:
~/.config/myfordmobile.json
{
"username": "",
"password": ""
}
F.authenticate("~/.config/myfordmobile.json")
Or, if you're using that filename (the default), you can omit it entirely:
F.authenticate()
If no arguments are passed to this constructor, environment variables (method 2) will be checked first before the config file is checked. If both techniques fail, and no username and password were provided, the authenticate()
call will fail.
-
Submit pull requests for individual features
-
Make sure things work locally before pushing
-
When pushing new changes to the function signatures or new documentation, re-generate the
Reference.md
file under /docs. You can usedocshund
to do this, thusly:
docshund prefect/__init__.py > docs/Reference.md
Install docshund with pip3 install -U docshund
.