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

Some Crashing Entries #30

Closed
brombomb opened this issue Jul 20, 2022 · 5 comments
Closed

Some Crashing Entries #30

brombomb opened this issue Jul 20, 2022 · 5 comments

Comments

@brombomb
Copy link

brombomb commented Jul 20, 2022

Found some entries from the logs that are causing FAIL errors.

Here's the log:

fail: TeslaMateAgile.PriceHelper[0]
      Failed to calculate charging cost / energy for charging process 415
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.ThrowHelper.ThrowNoElementsException()
         at System.Linq.Enumerable.Average(IEnumerable`1 source)
         at TeslaMateAgile.PriceHelper.DeterminePhases(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 141
         at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 91
         at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64
info: TeslaMateAgile.PriceHelper[0]
      Calculating cost for charges 01/15/2022 05:13:21 UTC - 01/15/2022 05:13:28 UTC
fail: TeslaMateAgile.PriceHelper[0]
      Failed to calculate charging cost / energy for charging process 416
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.ThrowHelper.ThrowNoElementsException()
         at System.Linq.Enumerable.Average(IEnumerable`1 source)
         at TeslaMateAgile.PriceHelper.DeterminePhases(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 141
         at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 91
         at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64
info: TeslaMateAgile.PriceHelper[0]
      Calculating cost for charges 03/14/2022 02:04:18 UTC - 03/14/2022 02:04:26 UTC
fail: TeslaMateAgile.PriceHelper[0]
      Failed to calculate charging cost / energy for charging process 465
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.ThrowHelper.ThrowNoElementsException()
         at System.Linq.Enumerable.Average[TSource](IEnumerable`1 source, Func`2 selector)
         at TeslaMateAgile.PriceHelper.DeterminePhases(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 145
         at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 91
         at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64

and here's some sample data (zip of a CSV and SQL insert statements)
charging_processes_202207192202.zip

@MattJeanes
Copy link
Owner

Hi @brombomb thanks for the error logs and zip very useful!

It seems that your charge was very very short so much so that there wasn't actually any records in the database where the charger current and voltage was recorded.

Would you mind sending me over the relevant data from the charges table as well as the charging_processes table? As a CSV would be perfect if you don't mind! Then I can see exactly what happened and add some code to at least prevent it throwing an error in this scenario.

To workaround this issue, you can manually set the cost for the charge to 0 in the database to stop TeslaMateAgile from trying to calculate it.

@brombomb
Copy link
Author

brombomb commented Jul 24, 2022

Here is a list of all the charges associated with the charging processes from the zip/csv above. Not all of these were errors but I included them because I couldn't tell at a glance what the common issue/thread was. If you need more data I'm happy to supply more rows.

charges_202207232048.csv

@MattJeanes
Copy link
Owner

MattJeanes commented Jul 24, 2022

Thanks very much - I've taken one of your examples and added it as a test case to re-create your error and added extra safeguards around the code in this area.

This is now released as v1.9.1 if you'd like to give it a go! Let me know if it solves your problem and then we can close this off 🙂

@brombomb
Copy link
Author

Looks good to me. No more errors in my logs! Thanks for the quick fix.

@MattJeanes
Copy link
Owner

Awesome! Thanks for trying it out 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants