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 #68

Open
Chimpepe opened this issue Nov 7, 2024 · 12 comments
Open

Unable to calculate cost of some charges #68

Chimpepe opened this issue Nov 7, 2024 · 12 comments

Comments

@Chimpepe
Copy link

Chimpepe commented Nov 7, 2024

Hello Matt,
since the changeover to winter time, I have had the problem that the prices are no longer calculated.
I have seen that there have been problems in the past. [https://github.com//issues/41]

Do you have the chance to take a look at this?

Release v1.16.0

Thanks,
Dawid

teslamateagile-1  | 2024-11-07 21:48:03.189 dbug: TeslaMateAgile.PriceService[0]
teslamateagile-1  |       Updating prices
teslamateagile-1  | 2024-11-07 21:48:03.264 info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Looking for finished charging processes with no cost set in the 'Home' geofence (id: 1)
teslamateagile-1  | 2024-11-07 21:48:03.345 info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculating cost for charges 11/03/2024 10:04:56 UTC - 11/03/2024 13:00:16 UTC
teslamateagile-1  | 2024-11-07 21:48:03.501 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Retrieved 4 prices:
teslamateagile-1  | 2024-11-07 21:48:03.501 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/03/2024 09:00:00 UTC - 11/03/2024 10:00:00 UTC: 0.2679
teslamateagile-1  | 2024-11-07 21:48:03.501 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/03/2024 10:00:00 UTC - 11/03/2024 11:00:00 UTC: 0.2561
teslamateagile-1  | 2024-11-07 21:48:03.501 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/03/2024 11:00:00 UTC - 11/03/2024 12:00:00 UTC: 0.2464
teslamateagile-1  | 2024-11-07 21:48:03.501 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/03/2024 12:00:00 UTC - 11/03/2024 13:00:00 UTC: 0.2564
teslamateagile-1  | 2024-11-07 21:48:03.501 info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Phase correction: 2 -> 3
teslamateagile-1  | 2024-11-07 21:48:03.513 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculated charge cost for 11/03/2024 10:00:00 UTC - 11/03/2024 11:00:00 UTC (unit cost: 0.2561, fee per kWh: 0): 2.530155393897083300453508 for 9.87956030416666653828 energy
teslamateagile-1  | 2024-11-07 21:48:03.525 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculated charge cost for 11/03/2024 11:00:00 UTC - 11/03/2024 12:00:00 UTC (unit cost: 0.2464, fee per kWh: 0): 2.691978432938666663210496 for 10.92523714666666665264 energy
teslamateagile-1  | 2024-11-07 21:48:03.537 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculated charge cost for 11/03/2024 12:00:00 UTC - 11/03/2024 13:00:00 UTC (unit cost: 0.2564, fee per kWh: 0): 2.786099471221333349428416 for 10.86622258666666672944 energy
teslamateagile-1  | 2024-11-07 21:48:03.537 fail: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Failed to calculate charging cost / energy for charging process 287
teslamateagile-1  |       System.Exception: Charge calculation failed, pricing calculated for 499 / 500, likely missing price data
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateDynamicChargeCost(IEnumerable`1 charges, DateTimeOffset minDate, DateTimeOffset maxDate) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 151
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 98
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 75
teslamateagile-1  | 2024-11-07 21:48:03.538 info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculating cost for charges 11/07/2024 10:35:28 UTC - 11/07/2024 12:00:05 UTC
teslamateagile-1  | 2024-11-07 21:48:03.606 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Retrieved 3 prices:
teslamateagile-1  | 2024-11-07 21:48:03.606 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/07/2024 09:00:00 UTC - 11/07/2024 10:00:00 UTC: 0.3609
teslamateagile-1  | 2024-11-07 21:48:03.606 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/07/2024 10:00:00 UTC - 11/07/2024 11:00:00 UTC: 0.3442
teslamateagile-1  | 2024-11-07 21:48:03.606 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       11/07/2024 11:00:00 UTC - 11/07/2024 12:00:00 UTC: 0.3445
teslamateagile-1  | 2024-11-07 21:48:03.606 info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Phase correction: 2 -> 3
teslamateagile-1  | 2024-11-07 21:48:03.608 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculated charge cost for 11/07/2024 10:00:00 UTC - 11/07/2024 11:00:00 UTC (unit cost: 0.3442, fee per kWh: 0): 1.535331128878666432185006 for 4.46057852666666598543 energy
teslamateagile-1  | 2024-11-07 21:48:03.621 dbug: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculated charge cost for 11/07/2024 11:00:00 UTC - 11/07/2024 12:00:00 UTC (unit cost: 0.3445, fee per kWh: 0): 3.790141417660000047237840 for 11.00186188000000013712 energy
teslamateagile-1  | 2024-11-07 21:48:03.622 fail: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Failed to calculate charging cost / energy for charging process 288
teslamateagile-1  |       System.Exception: Charge calculation failed, pricing calculated for 247 / 248, likely missing price data
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateDynamicChargeCost(IEnumerable`1 charges, DateTimeOffset minDate, DateTimeOffset maxDate) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 151
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 98
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 75
teslamateagile-1  | 2024-11-07 21:48:03.636 dbug: TeslaMateAgile.PriceService[0]
teslamateagile-1  |       Price update complete
teslamateagile-1  | 2024-11-07 21:48:03.636 info: TeslaMateAgile.PriceService[0]
teslamateagile-1  |       Waiting 300 seconds until next update

data-1731017330646.csv
data-1731017347818.csv

@MattJeanes
Copy link
Owner

Hey, thank you for the detailed debug logs and CSVs - very useful! I'll also need your TeslaMateAgile configuration too if that's cool e.g. which provider you are using and the configuration for it (excluding any sensitive info of course!)

@Chimpepe
Copy link
Author

Chimpepe commented Nov 8, 2024

no Problem! Let me know if you need anything else.

teslamateagile:
    image: mattjeanes/teslamateagile:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=1234567890
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - TeslaMate__UpdateIntervalSeconds=300
      - TeslaMate__GeofenceId=1
      - TeslaMate__EnergyProvider=Tibber
      - Tibber__AccessToken=1234567890

@MattJeanes
Copy link
Owner

Thank you! Looks like I wasn't correctly accounting for the end of the time window in certain edge cases in the Tibber provider, which hopefully the new preview version fixes.

Can you try out v1.17.0-rc.4 and let me know if that fixes it for you please?

teslamateagile:
    image: mattjeanes/teslamateagile:v1.17.0-rc.4

@MattJeanes
Copy link
Owner

Hey @Chimpepe - did you get a chance to try out the new version? How's it going for you?

@Chimpepe
Copy link
Author

Chimpepe commented Nov 16, 2024

Hey Matt, unfortunately not yet, have not charged due to the current high prices 😓

Last charge on 08.11. 2am-3am without issues.

I thing I can test it soon, sorry!

@MattJeanes
Copy link
Owner

No worries - keep me posted! Just want to make sure it's all working okay before I release the update properly 😄

@Chimpepe
Copy link
Author

So, finally. Test is running. I'll let you know the result!

@Chimpepe
Copy link
Author

Chimpepe commented Nov 24, 2024

Hey @MattJeanes looks like it's missing again with v1.17.0-rc.4

data-1732454147050.csv
Bildschirmfoto 2024-11-24 um 14 16 46

teslamateagile-1  | info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Looking for finished charging processes with no cost set in the 'Home' geofence (id: 1)
teslamateagile-1  | info: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Calculating cost for charges 11/24/2024 11:00:14 UTC - 11/24/2024 12:42:19 UTC
teslamateagile-1  | fail: TeslaMateAgile.PriceHelper[0]
teslamateagile-1  |       Failed to calculate charging cost / energy for charging process 292
teslamateagile-1  |       System.Exception: Mismatch of requested price info from Tibber API (expected: 4, actual: 3)
teslamateagile-1  |          at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 126
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateDynamicChargeCost(IEnumerable`1 charges, DateTimeOffset minDate, DateTimeOffset maxDate) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 109
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 98
teslamateagile-1  |          at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 75
teslamateagile-1  | info: TeslaMateAgile.PriceService[0]
teslamateagile-1  |       Waiting 300 seconds until next update

@Chimpepe
Copy link
Author

Ahh, now I also have the costs. Seems like I had to wait until the started hour was over.

So looks like it's working.

@MattJeanes
Copy link
Owner

Ah yes that makes sense! Thanks for the update before I went down a rabbit hole 😁

All good then you reckon?

@Chimpepe
Copy link
Author

I will charge again tonight, then I can tell you in the morning if everything went well.

Thanks for your gorgeous support!

@Chimpepe
Copy link
Author

Charging tonight also okay.

From my side all fine.

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