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

Unable to calculate cost of some charges #41

Closed
PalleRaa opened this issue May 25, 2023 · 11 comments
Closed

Unable to calculate cost of some charges #41

PalleRaa opened this issue May 25, 2023 · 11 comments

Comments

@PalleRaa
Copy link

I have a few charges where the price will not be calculated. I am using Energinet to provide the prices and it oftens works, but in some cases it does not.

Here is the log from the attempt to calculate the cost for this single charge "452"

Any idea what is wrong?

dbug: TeslaMateAgile.PriceService[0]
      Updating prices
info: TeslaMateAgile.PriceHelper[0]
      Looking for finished charging processes with no cost set in the 'Home' geofence (id: 4)
info: TeslaMateAgile.PriceHelper[0]
      Calculating cost for charges 05/23/2023 13:33:21 UTC - 05/23/2023 15:00:10 UTC
dbug: TeslaMateAgile.PriceHelper[0]
      Retrieved 5 prices:
dbug: TeslaMateAgile.PriceHelper[0]
      05/23/2023 10:00:00 UTC - 05/23/2023 11:00:00 UTC: 0.87898751125
dbug: TeslaMateAgile.PriceHelper[0]
      05/23/2023 11:00:00 UTC - 05/23/2023 12:00:00 UTC: 0.69429999125
dbug: TeslaMateAgile.PriceHelper[0]
      05/23/2023 12:00:00 UTC - 05/23/2023 13:00:00 UTC: 0.52374999750
dbug: TeslaMateAgile.PriceHelper[0]
      05/23/2023 13:00:00 UTC - 05/23/2023 14:00:00 UTC: 0.51081250
dbug: TeslaMateAgile.PriceHelper[0]
      05/23/2023 14:00:00 UTC - 05/23/2023 15:00:00 UTC: 0.58975000250
info: TeslaMateAgile.PriceHelper[0]
      Phase correction: 2 -> 3
dbug: TeslaMateAgile.PriceHelper[0]
      Calculated charge cost for 05/23/2023 13:00:00 UTC - 05/23/2023 14:00:00 UTC (unit cost: 0.51081250, fee per kWh: 0): 2.4673334913608334581895300000 for 4.83021361333333357776 energy
dbug: TeslaMateAgile.PriceHelper[0]
      Calculated charge cost for 05/23/2023 14:00:00 UTC - 05/23/2023 15:00:00 UTC (unit cost: 0.58975000250, fee per kWh: 0): 6.4808319197627931300064801272 for 10.98911724000000005088 energy
fail: TeslaMateAgile.PriceHelper[0]
      Failed to calculate charging cost / energy for charging process 452
      System.Exception: Charge calculation failed, pricing calculated for 255 / 256, likely missing price data
         at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 127
         at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64
dbug: TeslaMateAgile.PriceService[0]
      Price update complete
@MattJeanes
Copy link
Owner

Hi, would you mind exporting that particular charging process and associated charges table records to CSV and send them over? There shouldn't be any personal data but please verify and strip any out first before you do.

@PalleRaa
Copy link
Author

I would love to do that. If only I knew how. Can you give me a short "how to"?

@MattJeanes
Copy link
Owner

I've provided a short how to on another issue before, see if this helps if not I'll be happy to walk you through it: #17 (comment)

@PalleRaa
Copy link
Author

Never used pgAdmin before, or even logged into the database. But for some reason it just worked. Amazing. I have attached the .csv file. Let me know if it is not what you asked for.

data-1685037097905.csv

@MattJeanes
Copy link
Owner

Nice! That's one part of what I need, the other is the entries from the charges table for that charging_process_id

The query should be SELECT * FROM charges WHERE charging_process_id = 452

@PalleRaa
Copy link
Author

Like so?
data-1685041452114.csv

@MattJeanes
Copy link
Owner

That's perfect, thank you. I'll take a look and see what went wrong here.

@MattJeanes
Copy link
Owner

MattJeanes commented May 25, 2023

Okay it looks very similar to an issue I recently-ish pushed a fix for with version v1.11.3

Can you verify that you're on that version? If you're on an older one I suspect that will be why 😄

I ran your data through the latest code and it successfully retrieved all the price data (note my testing VAT and fixed prices will be different from yours):

  23/05/23 10:00:00 +00:00 - 23/05/23 11:00:00 +00:00 - 0.24781250
  23/05/23 11:00:00 +00:00 - 23/05/23 12:00:00 +00:00 - 0.18171249375
  23/05/23 12:00:00 +00:00 - 23/05/23 13:00:00 +00:00 - 0.05166250250
  23/05/23 13:00:00 +00:00 - 23/05/23 14:00:00 +00:00 - 0.03295000125
  23/05/23 14:00:00 +00:00 - 23/05/23 15:00:00 +00:00 - 0.11925000250
  23/05/23 15:00:00 +00:00 - 23/05/23 16:00:00 +00:00 - 0.48752498625

@PalleRaa
Copy link
Author

That would be slightly embarrassing if I am not on the latest release. Let me double check that later when I get home.

@PalleRaa
Copy link
Author

Updated to latest release (1.11.3) and now all charges calculates correctly.

@MattJeanes
Copy link
Owner

Great to hear, thanks for the confirmation! 🙂

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