Not the snappiest of titles, but it covers what we are trying to achieve! Some very smart people have worked out how to make your Tesla believe your Pi Zero W is a USB drive, this then uploads your saved clips and Sentry mode events to either a local NAS or Online service when you connect to WiFi.
This guide focuses on getting the sync to work to Google Drive, as the NAS transfer seems to work off the bat with the headless setup guide found on the Marcone teslausb github page linked below.
The instructions I’ve based this off have come from:
I’ve then filled in the blanks from lots of googling and a discussion thread on the https://teslamotorsclub.com forum.
You will need
Grab the latest TeslaUSB image
The Marcone fork is what I’ve used and seems to the most frequently updated.
I’d suggest grabbing the latest image file and burning it to your micro SD card, on my Mac, I use ‘ApplePi-Baker’
Configuring the WiFi
Once the image is on the micro SD card, on your laptop or desktop edit the “wpa_supplicant.conf.sample” file and replace your WiFi details within the quotation marks in the below section:
ssid=”YOURSSID (Wifi name)”
psk=”YOURPASSWORD (to connect to the Wifi network)”
Once done, exit and save the file, rename it to remove the .sample, so the new file should be wpa_supplicant.conf
You are now ready to put the microSD into the Pi and boot it up
Rclone config (to upload to Google Drive)
Once the Pi has power (plugging into your laptop/desktop is fine to power it) you should then SSH into it, on a Mac I use Terminal, choose your favourite SSH client in Windows. To do this in Terminal: ssh pi@raspberrypi
If you are prompted that “The authenticity of host XXXXXXX” etc.. type yes and press enter to continue.
The default password (you should change this once complete) is: raspberry
Once you are in, the next command to run is: sudo -i
Then: curl https://rclone.org/install.sh | sudo bash
Once this is completed, we now need to configure rclone, run this to start: rclone config
Use the following options;
- n for new remotes
- gdrive for name
- 13 for Google Drive
- Leave client_id and client_secret blank (hit enter to leave blank on both)
- Option 1 (some people have said option 3 works just as well)
- Leave root_folder_id and service_account_file blank (hit enter to leave blank on both)
- n to skip advanced config
- n for autoconfig
- Copy the link to create a token, then approve in the Google authentication screen
- Copy the verification code and paste into your SSH session.
- n for team drive
- y to confirm
- q then enter to quit config
Once rclone config is complete, run:
Next, run: rclone listremotes
This is to validate that you can see what you’ve just done has worked.
Then run the following one after the other:
rclone mkdir “$RCLONE_DRIVE:TeslaCam”
rclone lsd “$RCLONE_DRIVE”:
The last command should confirm that the TeslaCam folder now exists in Google Drive, if not, start over from the rclone config stage.
I would now recommend to set the camsize=60% and musicsize=10% leaving some free space on the drive. Without this, I started getting USB drive too slow errors, to do this, run the following commands one after the other:
Setting up TeslaUSB
Run the following commands one after the other, the final command takes a good while to run as it installs lots of components and pulls down from the teslausb repo.
mkdir -p /root/bin
chmod +x setup-teslausb
If prompted to delete snapshots, choose yes and press enter
This is where I’ve had to do a couple of extra changes not in the original instructions as it would not work without them and trust me, I rebuilt that image about 50 times trying to get this working!
When the setup-teslausb step has finally completed, we need to create a symbolic link from the .config folder to the mutable config directory, to do this, run:
ln -s /mutable/configs/rclone /root/.config/rclone
If you run the following;
ls -l /root/.config
This should confirm your symlink is in place (the –> shows it’s working, it should look like this (but with correct time stamps!)
lrwxrwxrwx 1 root root 23 Apr 22 15:01 rclone -> /mutable/configs/rclone
Now run: halt
This will stop the Pi, you can now safely unplug the Pi.
Get it in the car!
The next time you boot it up it’s good to go, so stick it in the car, do a test save once it’s booted up and the camera icon appears (teslausb only uploads saved records and sentry mode events).
If you need to SSH into the Pi again, the name will have now changed to teslausb, so use the command ssh firstname.lastname@example.org instead
You can SSH into the Pi to check what’s going on by reviewing the log file in the mutable folder by either tailing or editing the archiveloop.log file.