Coder Social home page Coder Social logo

bassmaster187 / teslalogger Goto Github PK

View Code? Open in Web Editor NEW
494.0 36.0 164.0 162.62 MB

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.

Home Page: https://www.teslalogger.de

License: GNU General Public License v3.0

C# 84.02% PHP 10.61% Shell 0.22% Dockerfile 0.05% CSS 4.61% Batchfile 0.01% JavaScript 0.39% Smalltalk 0.10%
tesla tesla-api mono raspberry grafana mariadb csharp raspberry-pi openstreetmap nominatim

teslalogger's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teslalogger's Issues

Logfile Spam / Offline

22.08.2019 06:36:43 : Reverse geocoding by Geofence
22.08.2019 06:36:44 : offline
22.08.2019 06:37:50 : Reverse geocoding by Geofence
22.08.2019 06:37:50 : offline
22.08.2019 06:38:57 : Reverse geocoding by Geofence
22.08.2019 06:38:57 : offline
22.08.2019 06:40:03 : Reverse geocoding by Geofence
22.08.2019 06:40:07 : offline

Authorisation für admin

Es wäre vielleicht gut noch eine Datei .htaccess in admin anzulegen mit folgendem Inhalt:

AuthType Basic
AuthName "Bitte melden Sie sich an"
AuthUserFile /var/www/html/admin/.htpasswd
require valid-user

Und dann mit htpasswd einen Benutzer mit Passwort einzurichten.

Dann kann nur dieser Benutzer auch auf die Seite zugreifen.

Michael

Security flaws?

1.) Root - Passwort dringend ändern!
2.) Router gegen ssh - Zugriffen sperren,
3.) Pi - Passwort dringend ändern!
4.) das File mit dem Klartextpasswort sollte die Berechtigungen 0400 haben, der Owner ist root, das Programm wird als root gestartet.
5.) alle Dateien sollten am besten nur mit 0400 oder 0600'er Berechtigung bereitgestellt werden, soweit möglich, wo das nicht geht, müste man herausfinden, warum es so ist.

Zu 4.) wäre es am besten, dass wenn es dann funktioniert, das Passwird an anderer Stelle abgespeichert und am "Originalplatz" gelöscht wird (automatisch durch die Anwendung), so dass auch der Zugriff über das per smb exportierte Verzeichnis nicht mehr möglich ist.

Auch die Mysql - Datenbank hat ein festes Passwort, auch hier müsste ggf. validiert werden, inwieweit es eine Gefahr von Fremdzugriffen gibt, wenn die allergrößten Lücken mal gestopft sind.

6.) Grafana nur Lesezugriff auf DB

Logfile spam during vehicle state offline

26.07.2019 07:17:25 : Reverse geocoding by Geofence
26.07.2019 07:17:26 : offline
26.07.2019 07:18:32 : Reverse geocoding by Geofence
26.07.2019 07:18:33 : offline
26.07.2019 07:19:39 : Reverse geocoding by Geofence
26.07.2019 07:19:40 : offline
26.07.2019 07:20:46 : Reverse geocoding by Geofence
26.07.2019 07:20:47 : offline
26.07.2019 07:21:53 : Reverse geocoding by Geofence
26.07.2019 07:21:54 : offline
26.07.2019 07:23:00 : Reverse geocoding by Geofence
26.07.2019 07:23:01 : offline
26.07.2019 07:24:07 : Reverse geocoding by Geofence
26.07.2019 07:24:08 : offline

errors in logfile that are not

e.g.
22.01.2019 10:57:31 : execute: git --version
22.01.2019 10:57:31 : Exception git ApplicationName='git', CommandLine='--version', CurrentDirectory='', Native error= Cannot find the specified file

22.01.2019 10:58:11 : Error: dpkg-preconfigure: unable to re-open stdin: No such file or directory

22.01.2019 10:58:11 : execute: git clone https://github.com/bassmaster187/TeslaLogger /etc/teslalogger/git/
22.01.2019 10:58:14 : Error: Cloning into '/etc/teslalogger/git'...

Startup of TeslaLogger should focuss in "Home" setting (configurable) on the last trip / charging event

If i open the TeslaLogger i'm interested in data from the last trip or the last charging.
That could be left like already in the app (-3 hours) or could be adapted to that
kind of intuitive setting "Last Trip" "Last Charging". It takes only some time/clicks to
adjust that properly .. but that is every time necessary in my case.
It's not an issue ... i would see that as an enhancement. The periods to determine a
trip could be configurable too or fixed to a setting of 1 or 2 hours without movement of the car.

Docker image

This issue is mostly a reminder for myself to create a docker image for TeslaLogger. I can probably use the Raspberry Pi image as a base for this.

Question: send personal data to teslalogger.de?

Hi,

quick question:
I wonder why you send personal data of the users to your http://teslalogger.de server, see WebHelper.cs.
Version of TaskerLogger (d.Add("v", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());) is fine for your logging, compare #39, but why

d.Add("t", TaskerHash);

d.Add("cv", DBHelper.currentJSON.current_car_version);
d.Add("m", carSettings.Model);
d.Add("bt", carSettings.Battery);
d.Add("n", carSettings.Name);
d.Add("eff", carSettings.Wh_TR);
d.Add("oc", option_codes);

d.Add("db_eff", carSettings.DB_Wh_TR);
d.Add("db_eff_cnt", carSettings.DB_Wh_TR_count);

d.Add("pw", power);
d.Add("temp", temperature);
d.Add("le", length);
d.Add("ln", language);

Either I do not understand it correctly or you want to have an overview who is using your tool with details you do not need to know.

From what i understood your motivation is to not trust any webservice, so why collecting personal data on your own?

Please get me correctly, i appriciate your work and approach and really want to use it as soon as my Tesla is delivered. I know I can configure it that there is no data push to your site.

Regards
GhostReader

Change Grafana Efficiency by model

Model S 75: 185 Wh/km
Model S 75D: 186 Wh/km
Model S 90D: 189 Wh/km
Model S P90D: 200 Wh/km
Model S 100D: 189 Wh/km
Model S P100D: 200 Wh/km
Model X 75D: 208 Wh/km
Model X 90D: 208 Wh/km
Model X P90D: 217 Wh/km
Model X 100D: 208 Wh/km
Model X P100D: 226 Wh/km

Model 3?

add .env file

for all configurable entities like credentials, urls, ...

Charge poll frequency

during charging, the poll frequency should be at 5 sec but insertig in DB should be depending on charging speed.
3kW - 10 Min
11kw-22kW - 1 Min
Supercharger - 10-30 sec

apt update errors

Hello is did a fresh install.
after ssh login I would like to run a sudo apt update and sudo apt upgrade, but I got the following errors:

pi@raspberry:~ $ sudo apt-get update
Get:1 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:3 https://deb.nodesource.com/node_10.x stretch InRelease [4,585 B]
Get:4 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:5 https://download.mono-project.com/repo/debian stable-raspbianstretch InRelease [2,242 B]
Get:6 http://archive.raspberrypi.org/debian stretch/main armhf Packages [221 kB]
Get:7 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [45.0 kB]
Get:8 https://deb.nodesource.com/node_10.x stretch/main armhf Packages [765 B]
Get:9 https://download.mono-project.com/repo/debian stable-raspbianstretch/main armhf Packages [50.8 kB]
Get:10 http://raspbian.raspberrypi.org/raspbian stretch/non-free armhf Packages [95.5 kB]
Fetched 12.1 MB in 22s (539 kB/s)
Reading package lists... Done
pi@raspberry:~ $ sudo apt-get upgrade
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pi@raspberry:~ $ sudo dpkg --configure -a
Setting up libapt-inst2.0:armhf (1.4.9) ...
Setting up apt-utils (1.4.9) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up udev (232-25+deb9u8) ...
addgroup: The group input' already exists as a system group. Exiting. update-initramfs: deferring update (trigger activated) Setting up systemd (232-25+deb9u8) ... addgroup: The group systemd-journal' already exists as a system group. Exiting.
dpkg: dependency problems prevent configuration of mono-complete:
mono-complete depends on mono-runtime (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-runtime on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-runtime-sgen (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-runtime-sgen on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on libmono-2.0-1 (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of libmono-2.0-1 on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on libmono-profiler (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of libmono-profiler on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-utils (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-utils on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-jay (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-jay on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-devel (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Package mono-devel is not installed.
mono-complete depends on mono-mcs (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-mcs on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-roslyn (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-roslyn on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-csharp-shell (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-csharp-shell on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-4.0-gac (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-4.0-gac on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on mono-4.0-service (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of mono-4.0-service on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on monodoc-base (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of monodoc-base on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on monodoc-manual (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of monodoc-manual on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on libmono-cil-dev (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of libmono-cil-dev on system is 5.16.0.220-0xamarin4+raspbian9b1.
mono-complete depends on ca-certificates-mono (= 5.18.0.240-0xamarin1+raspbian9b1); however:
Version of ca-certificates-mono on system is 5.16.0.220-0xamarin4+raspbian9b1.

dpkg: error processing package mono-complete (--configure):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for dbus (1.10.26-0+deb9u1) ...
Setting up systemd-sysv (232-25+deb9u8) ...
Setting up libpam-systemd:armhf (232-25+deb9u8) ...
Processing triggers for initramfs-tools (0.130) ...
Errors were encountered while processing:
mono-complete
pi@raspberry:~ $

IndexOutOfRangeException in Tools.StartSleeping

at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x001f9] in :0
13.08.2019 22:06:54 : System.IndexOutOfRangeException: Index was outside the bounds of the array.
at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x001f9] in :0
13.08.2019 22:06:57 : System.IndexOutOfRangeException: Index was outside the bounds of the array.
at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x001f9] in :0
13.08.2019 22:06:59 : System.IndexOutOfRangeException: Index was outside the bounds of the array.

Altitude not available at start drivestate

as the altitude comes trough the streaming api, it is often available a couple of seconds after the drivestate was set.

get the altitude of the last pos and use it for a beginning drivestate

Backup mit flexiblen DB-Angaben

Hallo Christian,

könnte man in der admin/backup.php noch einbauen, dass er backup.py ausführt, wenn es existiert? (Kann leider kein php...)

Ich habe das mal geschrieben, um eben mit eventuell anderen Datenbankparametern zu arbeiten. Das backup.py liest die aus der TeslaLogger.exe.config.

Michael

PS: oder statt backup.sh direkt backup.py nehmen...

backup.zip

Database connection test tries only 15 times instead of 30

Found a small error:

In file TeslaLogger/Program.cs, line 52, the comment says it tries 30 times.

The for loop looks like it tries 30 times, but in line 56 x gets incremented again, resulting in just 15 tries.

(3rd parameter to the for look increments once, line 56 another time)

[FR] Support import of existing logs from TeslaFi

For those of us who are current TeslaFi subscribers, it would be so incredibly useful to allow populating TeslaLogger with the historical logs from TeslaFi, even if only supported as a one-time import at start.

Thanks for the interesting project !

Teslalogger shutdown after exception in GetTokenAsync

System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
at System.Net.WebConnection.Connect (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x00044] in :0
at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000cc] in :0
at System.Net.WebOperation.Run () [0x0009a] in :0
at System.Net.WebCompletionSource1[T].WaitForCompletion () [0x00094] in <c0e40d34c25e4827874530676d4126b9>:0 at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in :0
at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x002e7] in :0
--- End of inner exception stack trace ---
at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00478] in :0
at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000ca] in :0
at TeslaLogger.WebHelper.GetTokenAsync () [0x0023a] in <92342f55183a4f08adac8c746f297265>:0

GetTokenAsync

Reboots...

Hallo Christian,

wenn man den TeslaLogger auf einem Server laufen lässt, auf dem auch noch andere Dienste laufen, ist es nicht ganz so ideal, wenn ein Reboot gemacht wird. Klar, auf einem dedizierten Raspi spielt das keine Rolle.

Aber ein vollständiger Reboot wäre doch wohl auch nicht notwendig, oder? Neustarten, des TeslaLoggers und ggflls. Grafana müsste doch reichen?

Grafana-Neustart ist ja kein Problem. Beim TeslaLogger bin ich mir nicht so sicher. Unter Unix würde man das sinnigerweise mit einem Signal machen, SIGHUP z.B. Keine Ahnung, ob das mit mono und C# funktioniert.

Kann man alternativ nicht ein Script "restart.sh" aufrufen, falls das existiert? Oder ein restart.sh mit /sbin/reboot haben, aber wenn restart-private.sh existiert, wird dieses aufgerufen. (Das wäre so ähnlich wie mit geofence...

Michael

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.