Mileage tracking (business vs. personal) #999
Replies: 18 comments 3 replies
-
This seems to be a mix of #505 and #989 and a new feature ("in car tagging") |
Beta Was this translation helpful? Give feedback.
-
#989 should be dead easy, since the drives tables has "start_km" and "end_km" - sp that is purely a bit of Grafana exercise.. But yes - I think either 2 more columns to drives table (the type, could be integer/smallint, and the "note" a varchar or text) - or a separate table referencing the drives table... Both should be a breeze to build - and creating a Grafana layout with all those filtered drives (and perhaps a simple summary on top) also a small feat.... I will gladly participate...... Only challenge I can see, would be to allow for setting a default/automated drive type, but that could be "on top", the data structure could come first, and would give 99% of the benefit... |
Beta Was this translation helpful? Give feedback.
-
#989 is already done (or at least for a special case), so "only" the part with the data-layer is missing. I would volunteer for the Grafana-part in case someone (@tonypilborg ?) volunteers for the data-layer-part... |
Beta Was this translation helpful? Give feedback.
-
From my brief (very brief) scanning of the issue, I don't think it is covered - even the special case.. So for the sake of taxation - it is either (probably both) necessary to be able to adjust manually (although this could be done in an excel extract, or be able to use end_km as the start_km for the next drive.... And it is then complicating the SELECT in the "tax report", since start_km drive x has to be inherited from end_km drive x-1, even if drive x-1 is not included in the select (if it was a private putpose, and thus not applicable for the tax report)... (in other words - when your are looking at the Grafana part, you should SELECT all drives, but only display those with the chosen "purpose". - and then actually always use end_km from the previous drive as the start_km.... (except if the previous drives wasn't logged - which could happen.. So perhaps include all 3: end_km(x-1), start_km(x), end_km(x) - for all drives, and then filter which lines are shown...) I actually don't have a dev install of TeslaMAte - but the structure could simply be: CREATE TABLE public.drivepurpose ( CREATE TABLE public.purpose ( I would ever only use business or private purposes - but other might choose something more granulated (especially if somebody taskes up the idea of pre-populating the purpose automatically... And if purpose is something other that business, perhaps the drivepurpose_customer should be called something else.... ... but obviously it is needed to allow maintenance of these tables - links in Grafana to TeslaMate??? |
Beta Was this translation helpful? Give feedback.
-
I don't think we'd need a specific column for purpose if tagging (#505) was implemented. It would allow you to tag drives with a purpose, but also with many other things (perhaps driver, trip for drives as part of a larger trip, etc). If tagging is implemented as an opt-in system such as charge costs are, where certain geofences might trigger an automatic tag if you configure it or otherwise tagging can be applied manually, it should suit both use cases - those who want automatic tagging or those who want to do it manually. |
Beta Was this translation helpful? Give feedback.
-
I idsagree.... Or rather, I agree only if tagging could then be more than one dimension... If you consider the case with business trips, a tagging as business makes sense, but it could be very valuable with a way to mark a drive with a customer name (for tax purposes)... But I agree - much more elegant as an opt-in option, like for charging... Although that implementation can not be directly copy-pasted. We would need a table for these tags, irrespective of the number of tagging dimension 👍
|
Beta Was this translation helpful? Give feedback.
-
Just tag it with the customer's name? Your column is one-dimensional - it's one value per drive. Tagging is inherently multi-dimensional as you can apply multiple tags for multiple things Frankly, you're pushing for a worse design |
Beta Was this translation helpful? Give feedback.
-
You are absolutely right! That is clearly a good solution - and I can't think of a scenario where some Grafana logic wouldn't be able to cater for any requests/filtering. Do you have any insights in to the issue with "missing start of drives"? I am aware I could export all to excel, and then do some managing there . but it would be great to have it built in to the report set :) |
Beta Was this translation helpful? Give feedback.
-
There are two separate issues covering that, I have been following the issues but I think they're somewhat multi-faceted. The issues are #912 and #785 and I do think the suggestion of a UI to allow modifying the start/end time of a drive is a good one, perhaps one to propose in #912 |
Beta Was this translation helpful? Give feedback.
-
You're welcome to check out my tesla_journal repo (https://github.com/emilfors/tesla_journal) if you need this functionality ASAP. The UI is in Swedish only so far, so sorry about that. Work in progress. |
Beta Was this translation helpful? Give feedback.
-
A few notes of feedback - after I have installed:
And some "bugs" (I assume):
And then some of the generic notes: I like some of the ideas - the grouping/ungrouping is great - and marking of private vs. business equally so, It is super easy to use! Definitely some good ideas - let me know if you need inputs (I can translate to Danish and English with confidence) or testing.... |
Beta Was this translation helpful? Give feedback.
-
OK - I just browsed the code, and I can see you have added tables in the TeslaMate database... That worries a bit, and I would have preferred a note about that. (but no panic, I assume you are only writing to those 2 tables? But for the sake of sleeping calm - I would probably go with separate db users for TeslaMate and Tesla_Journal, and make sure the latter can only read from the main tables... But anyway some noise also regarding backup etc... |
Beta Was this translation helpful? Give feedback.
-
Hi Tony, thanks for checking out the project. You're actually its very first user besides me :) Here's a brief background which I guess will answer a few of your questions. I took delivery of my Tesla late August. I used to have an OBDII dongle-based solution for keeping a drive journal, but soon realized that wouldn't fly with the new car. So I started looking for alternatives. While doing that I came across TeslaMate which seemed like an awesome thing altogether and also like it might suit my journal keeping needs. Unfortunately it didn't, but I thought I could at least leverage its data tracking and tweak the Grafana UI into doing what I needed. So I started trying to do that, I think I spent a couple of weeks on it but eventually gave up. I just couldn't seem to understand how to make Grafana accept input and not just produce data visualizations. I toyed with the idea of modifying TeslaMate itself but that would still mean I'd need to build a separate UI (since I couldn't make Grafana act as one). This wasn't intended for anyone else's use but mine, which may or may not be obvious. That's one reason why I didn't actually consider security at all (i.e. just piggybacking on the teslamate db user). Another is that I didn't know PostgreSQL either and didn't want to spend time figuring out users, access rights and all that. I thought IF that would prove necessary, then that's always something that can be changed later. To answer your question, yes, my project writes two its own two tables only, and reads from the others. I made the repo public because I thought it might actually be useful to someone else and because I could use some help testing it. As I made this for my own intents and purposes, it caters to Swedish regulations only at this point - as far as I know it's compliant barring the fact that you need to be able to add comments to the trips (so you can let the tax authorities know what they were for). That's what I'm working on now - adding a detailed trip view where you can add that information. After that, the next step is implementing a report generator (probably just spitting out a PDF). And just as you say, in the generated report I intend to include odometer readings, hide the private trips and so on. TL;DR - I made this in part because I need it personally and in part as a way of teaching myself Go, PostgreSQL, JQuery and a few other things that I needed to learn anyway. |
Beta Was this translation helpful? Give feedback.
-
@emilfors: And the option to set the type of drive - the default marking - through a webservice (sure it would be easy in Tesla_journal) - so that I would have to think about it, if I just remember to set the proper type before driving - that would be great :) |
Beta Was this translation helpful? Give feedback.
-
I finally got my finger out of wherever i forgot it....... And maintained my 4 corrupted drives in the database... After having made my first month of mileage reporting - in excel with a dump from the "dutch_tax" report - I realize how much of an improvement the classification AND grouping of drives could be. A few suggestion:
I REALLY like hos the grouping of trips is designed - easy and efficient. - correct me if I am wrong, but you just use: @adriankumpf: it would be SO nice, if you could make a switch in the TeslaMate interface - to select default classification of drives (business vs. personal)... Perhaps complying with the table name introduced by Emil?? |
Beta Was this translation helpful? Give feedback.
-
Hey Tony, sorry for the late reply. Totally swamped with "real" work at the moment so there hasn't been much time to work on this lately. I'm hoping to change that soon :)
I'm glad you like the grouping feature! I think it's pretty useful myself. Yes, that's exactly right. Start time and address of the first drive in the group, end time and address of the last and the driven distance and time are the sums of all drives in the group. Cheers :) |
Beta Was this translation helpful? Give feedback.
-
@adriankumpf could we potentially get an update on this feature request to sort trips between two locations or trips that begin from certain destinations in our TeslaMate as business / personal? With tax day here in the United States coming up on April 15 -- it would be so amazing to have this feature instead of going through and manually classifying every trip we've got logged in our drives. |
Beta Was this translation helpful? Give feedback.
-
@adriankumpf still looking to see if this feature request could get some attention with Tax day coming up here pretty fast here in the United States. Would it be possible to add these business/personal mileage tracking features to Teslamate/Grafana? |
Beta Was this translation helpful? Give feedback.
-
What would you like to be added:
Ability to flag each drive - as personal or business.
Ability to export reports - with relevant selectable drives data, like start address, end- address, Km, date+time, odometer start-end, etc...
(or more applicable: create a slightly altered Grafana view, with filter for "trip type", and the data from above.. - similar to "Drives" or "Trip" - only with some different data and filters...)
Why is this needed:
For tax purposes - and to not having to rely of manual tracking or expensive (or poor) app, with questionable impact on battery of phone etc.
Additional context:
It would be brilliant if it was somehow possible to select "something" in the car before or during a drive (I know driver profile is not an option) - perhaps a "mode switch", through MQTT or web (Siri shortcut or similar).. But obviously needed to be able to change/re-classify afterwards.
Perhaps also an option to add a note - like costumer name if parking is not next to that company... I know some of it could be solved with geo-fencing, but perhaps it is not a good idea to abuse to core geofencing for that (so a copy of the function, just for this purpose) - perhaps it is all perfect to use the existing geo-fences??? That could solve automatic "costumer tagging", but a way to alter for a specific drive would be valuable...
Beta Was this translation helpful? Give feedback.
All reactions