goRt
Active Member
Mine used to do that, then I got MCU2
You can install our site as a web app on your iOS device by utilizing the Add to Home Screen feature in Safari. Please see this thread for more details on this.
Note: This feature may not be available in some browsers.
As promised (although delayed, working from home and home schooling a 6 year old haven't done much for my productivity!) an updated guide for the Google Drive backups.
If you haven't set them up yet, then just crack on. If you've already got this running, then complete the Get a Google Client ID and Client Secret section, then scroll down to the bottom to edit your existing rclone config
How to perform an automated TeslaMate backup to Google Drive - TeslaEV.co.uk
Thanks to @StuC and @spooksman for helping me test the instructions and proving some helpful feedback.
The issue with htpasswd files is that Apache doesn't do any sort of rate-limiting to prevent someone from bruteforcing your credentials. If you're watching your logs you will certainly see this going on, but if you're not checking or alerting on that activity you'll never know.
You could look to layer some additional protection by using something like Cloudflare in-front of your VPS, they have a guide on implementing rate limiting, and then blocking all traffic not originating from Cloudflare or your house. My preferred route for internet facing systems is to use something like the CSF firewall in combination with Webmin, and use the "Dynamic DNS" feature in CSF to automatically update the firewall whenever your home IP changes. CSF also includes port-scanning detection and will automatically ban IP addresses attempting to detect services on your system. You can also configure CSF to watch Apache's log files and ban IP addresses attempting to bruteforce you (similar to how Fail2Ban works).
In reality though the safest (and simplest) solution is to not permit any external access to your Teslamate installation. This is the approach I have taken, but crucially with OpenVPN so that I can dial back into my home network (I self host) while I'm away if I need to access my data. That can also be done on a VPS too, something like OpenVPN Access Server is ideal, it gives you a GUI to manage OpenVPN and without the hassle of managing lots of CLI config. It's intended for businesses but you get two concurrent connections free which is plenty for home use. If I'm out and about and need access to Teslamate, I just fire up the OpenVPN app on my phone, connect back to my house, and then login to Teslamate. Adds about 20-30 seconds... but that could even be automated if I was bothered enough by it!
root@raspberrypi:~# wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
OK
root@raspberrypi:~# echo "deb http://as-repository.openvpn.net/as/debian buster main">/etc/apt/sources.list.d/openvpn-as-repo.list
root@raspberrypi:~# apt update && apt -y install openvpn-as
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Hit:3 http://packages.microsoft.com/repos/code stable InRelease
Get:4 http://as-repository.openvpn.net/as/debian buster InRelease [3,185 B]
Hit:5 https://download.docker.com/linux/raspbian buster InRelease
Fetched 3,185 B in 2s (1,923 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
N: Skipping acquire of configured file 'main/binary-armhf/Packages' as repository 'http://as-repository.openvpn.net/as/debian buster InRelease' doesn't support architecture 'armhf'
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openvpn-as
root@raspberrypi:~#
Tried this last night and couldn't get it to work however I think it was user error, as i've tired a test upload and its worked fine. Will see how the cron job runs tonight @ 03:00.
Many thanks for taking the time to find a work around / update the guide.
Is your understanding Google is capping it over a period of say 24 hours, so if you did your update earlier to midnight (assumedly US time?) it might work as a bypass
Have tried this as its something I wanted remote access too but was put off by the idea of having it internet facing (can't be too careful these days)
I have tried following the steps on the OpenVPN setup pages but I keep getting an error. I think it might be because the file its looking up to has changed but I don't have the experience to 'fix' it.
Step 1 & 2 go fine then it breaks, Any thoughts?
Yep - I missed two days of data, including a long drive with DC supercharging. Bummer! Was surprised to be met with a login screen instead of the normal view of the cars. All updated, easy as.Tesla have turned off the old V2 Auth and replaced with the V3, so if you don't do this and your token runs out, the data will stop flowing to TeslaMate until you update and sign back in.
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
cd /root/teslamate
sudo /usr/local/bin/docker-compose exec database psql teslamate teslamate
DELETE FROM drives WHERE distance < 1.6;
Just checking you've noticed the minimum distance filter at the top of the drives page?This creates lots of very small 'drives' in teslamate, which are just annoying.
I have to admit, didn't notice that.Just checking you've noticed the minimum distance filter at the top of the drives page?
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
cd /root/teslamate
sudo /usr/local/bin/docker-compose exec -T database psql teslamate teslamate <<END
DELETE FROM drives WHERE distance < 1.6;
END
I have to admit, didn't notice that.
That only filters them out. doesn't remove them from database and thus the calculations?
testing a code mod:
I think this works? Please don't test on your own database, I'm just trying stuff.Code:#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin cd /root/teslamate sudo /usr/local/bin/docker-compose exec -T database psql teslamate teslamate <<END DELETE FROM drives WHERE distance < 1.6; END
Yeah those less than 1 mile drives are annoying.Let us know if this works. I've just got home and had a "drive" I need to delete (a few others historically too) - I was just at the Woodall Superchargers and most were full, so started charging next to somebody, and then after about 10 minutes the 2 cars in the next bays both left, so I moved over by a bay so both I and the guy next to me could get max charge rates, so I now have a 0.01 mile drive in my history!
sudo docker-compose exec -T database psql teslamate teslamate
SELECT * FROM drives WHERE distance < 1.5 ORDER BY distance;
DELETE FROM drives WHERE distance < 1.5;
Thanks Dave, I just tried this for the first time and it works perfectly, great guide!Just updated the Google Drive backup guide for what I hope is the last time (what a pain!)
Thanks Dave, I just tried this for the first time and it works perfectly, great guide!
There are only a couple of minor points I found:
- rclone config option for gdrive seems to have moved from 13 to 15 (at least in my install, I run Docker via openmediavault on my pi); I also used 'Option 3' after entering client secret which seems fine.
- I use an external USB drive on my pi (as I use it it for Time Machine backups also), which is where I set my Docker storage to save wear on the microSD card and created a folder to store the backups for the same reason. I'm pretty new to Docker and found I had to run the docker-compose command in the backup script from the directory where docker-compare.yml is located (should be obvious I suppose!)
Thanks again for all your hard work!
Just updated my bulk import post on my site with the three latest Superchargers to go live
Code:INSERT INTO public.geofences (name, latitude, longitude, radius, inserted_at, updated_at, cost_per_kwh, session_fee) VALUES ('Wyboston Supercharger', 52.202366, -0.291631, 35, '2020-08-27 05:36:00 ', '2020-08-27 05:36:00 ', 0.24, NULL); INSERT INTO public.geofences (name, latitude, longitude, radius, inserted_at, updated_at, cost_per_kwh, session_fee) VALUES ('Hilton Park, Southbound Supercharger', 52.644065, -2.054251, 35, '2020-08-09 05:29:00 ', '2020-08-09 05:29:00 ', 0.24, NULL); INSERT INTO public.geofences (name, latitude, longitude, radius, inserted_at, updated_at, cost_per_kwh, session_fee) VALUES ('Leeds-Whitehouse Street Supercharger', 53.784556, -1.532498, 35, '2020-08-09 05:27:00 ', '2020-08-09 05:27:00 ', 0.24, NULL);
Full post here if anyone who hasn't done the bulk import wants to (or just needs a reminder of the instructions to add the above), I've also updated the Washington Supercharger location, the supplied latitude / longitude were incorrect:
TeslaMate - How to bulk import UK Supercharger locations - TeslaEV.co.uk