Hello TMC!
Allow me to introduce TeslaPSTN: A "software" that allows you to access/control the Tesla API through the free-of-charge and open source Asterisk PBX. Why the quotes? Because it's just a single (Bash) shell script and I am not a programmer, a "scripter" at most if such a term exists.
What's this for?
I'm offering a Tesla Model S 85 with AP1 for rent here in Frankfurt, Germany, via Turo.com, and since recently I'm offering the car in "self-service" mode, meaning no human will be present during pickup and return of the car. Instead, the renter will get access to the Tesla app and can unlock the car this way and pick up the keyfob from the glovebox (Passive Entry disabled so the car won't open by itself when a stranger presses the door handle).
So far, so good, but when I realized that more renters are from abroad than from within Germany I thought about how to improve that process. Because, what if a renter doesn't own a smartphone, or the renter just arrived at the airport from abroad and their SIM doesn't allow data roaming (or it's too expensive), or the renter starts to mess around with the app the night before they're going to pick up the car and opens the frunk, which won't close again through the app, resulting in the car sitting on the street with the frunk open overnight. The app solution only allows access to everything or nothing.
TeslaPSTN solves this problem by the renter calling a cheap/free fixed-line telephone number (BTW, Wiki: PSTN), authorizes themselves via a previously assigned PIN code, and can then only access the API functionality that I granted them, in the Turo rental example that would be only unlocking and locking the doors, via DTMF (beep beep digits over the phone
).
Other possibilities: Maybe you want to grant a relative access to only some limited functionality of the car, and not everything that the app allows. Or maybe you are somewhere where there's no internet connectivity but you still would like to communicate with your Tesla to check if it's still charging, check SoC etc...
Asterisk not only allows connectivity via PSTN, but also via SIP ("Voice over IP") and many other communication channels, so you could also communicate with your Tesla through a SIP-compatible device, a softphone on your PC or whatever, or receive text messages from the cell network and send commands accordingly. I am not sure what this could be useful for, but maybe there is a use case.
Requirements:
- A computer with Linux, BSD or any other operating system which supports the "Bash" shell
- Asterisk
- curl
- jq
... and TeslaPSTN (link)
I set up a few phone numbers in the US and in Canada so you can test a simple demo by yourself and query the SoC of my rental Tesla, as follows:
LA: (213) 293-3690
NY: (646) 630-8643
Toronto: (437) 370-1837
(in English language)
Germany: 06083-8734444
Austria: 0720-022022
Switzerland: 044-5511111
(in German language)
PIN code: 445566
And when being prompted for a command, press 1
Have fun,
Markus
PS: As of today only a few API commands are implemented: flash, honk, unlock, lock, getsoc, gettypical. If you need something else just let me know and I'll implement it. (Or you can do it by yourself by just copying a few lines of code)
Allow me to introduce TeslaPSTN: A "software" that allows you to access/control the Tesla API through the free-of-charge and open source Asterisk PBX. Why the quotes? Because it's just a single (Bash) shell script and I am not a programmer, a "scripter" at most if such a term exists.
What's this for?
I'm offering a Tesla Model S 85 with AP1 for rent here in Frankfurt, Germany, via Turo.com, and since recently I'm offering the car in "self-service" mode, meaning no human will be present during pickup and return of the car. Instead, the renter will get access to the Tesla app and can unlock the car this way and pick up the keyfob from the glovebox (Passive Entry disabled so the car won't open by itself when a stranger presses the door handle).
So far, so good, but when I realized that more renters are from abroad than from within Germany I thought about how to improve that process. Because, what if a renter doesn't own a smartphone, or the renter just arrived at the airport from abroad and their SIM doesn't allow data roaming (or it's too expensive), or the renter starts to mess around with the app the night before they're going to pick up the car and opens the frunk, which won't close again through the app, resulting in the car sitting on the street with the frunk open overnight. The app solution only allows access to everything or nothing.
TeslaPSTN solves this problem by the renter calling a cheap/free fixed-line telephone number (BTW, Wiki: PSTN), authorizes themselves via a previously assigned PIN code, and can then only access the API functionality that I granted them, in the Turo rental example that would be only unlocking and locking the doors, via DTMF (beep beep digits over the phone
Other possibilities: Maybe you want to grant a relative access to only some limited functionality of the car, and not everything that the app allows. Or maybe you are somewhere where there's no internet connectivity but you still would like to communicate with your Tesla to check if it's still charging, check SoC etc...
Asterisk not only allows connectivity via PSTN, but also via SIP ("Voice over IP") and many other communication channels, so you could also communicate with your Tesla through a SIP-compatible device, a softphone on your PC or whatever, or receive text messages from the cell network and send commands accordingly. I am not sure what this could be useful for, but maybe there is a use case.
Requirements:
- A computer with Linux, BSD or any other operating system which supports the "Bash" shell
- Asterisk
- curl
- jq
... and TeslaPSTN (link)
I set up a few phone numbers in the US and in Canada so you can test a simple demo by yourself and query the SoC of my rental Tesla, as follows:
LA: (213) 293-3690
NY: (646) 630-8643
Toronto: (437) 370-1837
(in English language)
Germany: 06083-8734444
Austria: 0720-022022
Switzerland: 044-5511111
(in German language)
PIN code: 445566
And when being prompted for a command, press 1
Have fun,
Markus
PS: As of today only a few API commands are implemented: flash, honk, unlock, lock, getsoc, gettypical. If you need something else just let me know and I'll implement it. (Or you can do it by yourself by just copying a few lines of code)