Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: incomplete charges #109

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

tobiasehlert
Copy link
Owner

Feature to show incomplete charges and handle them slightly different.

Original PR: #93

alecdoconnor and others added 12 commits July 20, 2021 16:36
While these are usually charges that failed, they also include charges that are in progress. The client should be able to see these Charges and decide how to proceed. These charges were, at one point, real charges with relevant data.

Reasons for failure:
- Charging started, TeslaMate server or Tesla API went offline
- Charging in progress (not actually failure, just incomplete charge data)

This will also allow the user to know about the charge's existence and query (by ID) the Charge Details. Since the database stored the many charge detail objects, the user may be able to process some additional information about the charge. Especially if the charge is in progress.

Example:
1. Charge is in progress.
2. Receive basic charge data, like start date and charge ID. 
3. Query Charge Details to info like: start date, power over time, etc.

However, even with access to this additional data that does exist, the user still will not be able to see data from when the charge went offline. Or in the case the charge is still occurring, the user can't see charge details that haven't happened yet.

Therefore,
Charge Details require an additional parameter `isCompleted:BOOL` so the user knows if an object is finalized.

**The user will have to determine whether the charge is still in progress or corrupted, by seeing if there are any recent charges. If it's in progress, the user should consider refreshing that charge object in the future.**

I chose to add this as a separate object on `Data` so that it will not affect existing API users. This will ensure incomplete charges are not treated as completed charges.
Finally got builds working on my local machine. Next few commits may to fix bugs from new code
This reverts commit 6a8554e.
Existing issue, chargesdata is null when empty. To check, set ?page=10 and see the response. An empty array is more useful and clear
Display incomplete charge data
@tobiasehlert tobiasehlert added enhancement New feature or request go Pull requests that update Go code labels Oct 11, 2021
@sonarcloud
Copy link

sonarcloud bot commented Oct 11, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
42.6% 42.6% Duplication

@tobiasehlert
Copy link
Owner Author

@alecdoconnor, now you can specify the docker imager with tobiasehlert/teslamateapi:feature-incomplete-charges and see if it behaves like you expect it to.

Btw, something similar interesting for incomplete drives?

@alecdoconnor
Copy link
Contributor

Hey! I actually tested this with a local build, once I figured out how! It worked great for me.

What did you mean by, "Btw, something similar interesting for incomplete drives?"

@tobiasehlert tobiasehlert changed the title Feature incomplete charges Feature: incomplete charges Oct 11, 2021
@tobiasehlert
Copy link
Owner Author

Hey! I actually tested this with a local build, once I figured out how! It worked great for me.

Ok great!
I will testrun it and see if I get the same thing. First I got to find some charges that are not completed.. that's the first mission :P

What did you mean by, "Btw, something similar interesting for incomplete drives?"

I thought that it maybe could happen that even a drive is incomplete the same way as a charge. Therefore the question.. but oyu might not have experienced anything like that?

@alecdoconnor
Copy link
Contributor

alecdoconnor commented Oct 12, 2021 via email

@tobiasehlert
Copy link
Owner Author

Hi @alecdoconnor,

My wife went driving today while I was at the computer and checked.. there is no active drive ongoing when driving, so that seems to be inserted first when completed.
So based on that, this should only be implemented for charging.. I'll check today evening when charging the car at 23:00 :)

Regards,
Tobias

@tobiasehlert
Copy link
Owner Author

Hi @alecdoconnor,

My car is currently charging and I can't see an entry for the ongoing charge in the charges list and also when using the supposed to be added ID, it's not returning anything for me.
So I can't see to get the same issue as you got 🤔

Regards,
Tobias

@alecdoconnor
Copy link
Contributor

alecdoconnor commented Nov 9, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants