Smart Car

In the northeast, it gets really cold and unfortunately for me, I like to do most things really early in the morning. This means there's usually a nice layer of ice, cold engine bay, and freezing car waiting for me before I can begin my day.

I recently got an iPhone that allows users to create mini-programs and automation on their phones using Shortcuts. These shortcuts can be anything from toggling your cellular data on/off to sending a text message to your family when you leave work. Shortcuts also let you integrate with apps - for example, you can use shortcuts to script/automate a Twitter DM.

Shortcut to send a message when I leave NJIT campus

Shortcut integrated with twitter to send a direct message

I wanted a shortcut that will automatically start my car after my alarm rings in the morning. Unfortunately, the myMazda app which allows me to start my car does not have any integrations for shortcuts - meaning that simply setting something up on my phone isn't enough.

Shortcuts, however, lets you make web requests. So if I can use that to ping a server that communicates with my car then I will be able to automate my car starting up on cold days.

The server

For the physical server hardware, I set up a Raspberry Pi to do the job. It uses low power, has enough processing power. I used python flask (microframework) to handle the web requests coming into the raspberry py. The flask server used the pymazda library to communicate with my car and give it instructions to start the engine and perform other actions.

The server has 3 API endpoints. One endpoint to start the car, one to unlock the doors, and one to lock the doors.

I didn't want my endpoints to be publicly accessible, so I pulled some inspiration from API that I have used in the past. All requests made to the server must contain a key variable as a parameter. If and only if the key variable is correct will the webserver execute the request and communicate with my car.

The Shortcut and Automation

With the server running, the only thing left was to make the shortcut that starts the car after my alarm rings.

I added some logic in the shortcut to only start the car if it is sufficiently cold outside that way I wouldn't be burning gas needlessly.

Automation to start car after my alarm rings

Shortcut to make request to server and start car