MattJeanes / TeslaMateAgile

Integration to automatically fill in prices for charge data captured by TeslaMate for smart energy providers
MIT License
82 stars 10 forks source link

Error calculating costs with Tibber provider #33

Closed JonasF1 closed 1 year ago

JonasF1 commented 1 year ago

Hi, Have used this excellent app with my Teslamate installation. But now it does not work anymore. Stopped working 3-4 weeks ago. Get following error on my docker instants when using the Tibber provider.

teslamateagile_1  | dbug: TeslaMateAgile.PriceService[0]
teslamateagile_1  |       Updating prices
teslamateagile_1  | info: TeslaMateAgile.PriceHelper[0]
teslamateagile_1  |       Looking for finished charging processes with no cost set in the 'Garaget' geofence (id: 1)
teslamateagile_1  | info: TeslaMateAgile.PriceHelper[0]
teslamateagile_1  |       Calculating cost for charges 10/28/2022 19:30:04 UTC - 10/28/2022 19:30:10 UTC
teslamateagile_1  | fail: TeslaMateAgile.PriceHelper[0]
teslamateagile_1  |       Failed to calculate charging cost / energy for charging process 1287
teslamateagile_1  |       System.NullReferenceException: Object reference not set to an instance of an object.
teslamateagile_1  |          at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 68
teslamateagile_1  |          at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 86
teslamateagile_1  |          at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64
teslamateagile_1  | info: TeslaMateAgile.PriceHelper[0]
teslamateagile_1  |       Calculating cost for charges 11/21/2022 01:23:31 UTC - 11/21/2022 03:28:46 UTC
teslamateagile_1  | fail: TeslaMateAgile.PriceHelper[0]
teslamateagile_1  |       Failed to calculate charging cost / energy for charging process 1313
teslamateagile_1  |       System.NullReferenceException: Object reference not set to an instance of an object.
teslamateagile_1  |          at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 68
teslamateagile_1  |          at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 86
teslamateagile_1  |          at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 64
MattJeanes commented 1 year ago

Hi, I'm seeing the same thing on my end for any call to Tibber's API for all requests right now so I am guessing either they've changed the API without documenting it or they're having some issues right now. I'd recommend contacting their support for more information. You can tell them that the Data.Viewer.Homes[0].CurrentSubscription is null in their GraphQL API response which may help them.

JonasF1 commented 1 year ago

Hi, Did as you suggested. Contacted the Tibber support. They seems to have fixed the issue now! Now I get price info on my charges. :) Thanks for excellent application.

Here is log from my latest charge. teslamateagile_1 | dbug: TeslaMateAgile.PriceService[0] teslamateagile_1 | Updating prices teslamateagile_1 | info: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Looking for finished charging processes with no cost set in the 'Garaget' geofence (id: 1) teslamateagile_1 | info: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Calculating cost for charges 11/26/2022 00:00:11 UTC - 11/26/2022 01:48:48 UTC teslamateagile_1 | info: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Phase correction: 2 -> 3 teslamateagile_1 | dbug: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Calculated charge cost for 11/26/2022 00:00:00 UTC - 11/26/2022 01:00:00 UTC (unit cost: 2.8662, fee per kWh: 0.75): 29.279888673462000038910312 for 8.09686651000000001076 energy teslamateagile_1 | dbug: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Calculated charge cost for 11/26/2022 01:00:00 UTC - 11/26/2022 02:00:00 UTC (unit cost: 2.7134, fee per kWh: 0.75): 23.006089902465998244610344 for 6.64263148999999949316 energy teslamateagile_1 | dbug: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Calculated charge cost for 11/26/2022 02:00:00 UTC - 11/26/2022 03:00:00 UTC (unit cost: 2.7248, fee per kWh: 0.75): 0.0000 for 0 energy teslamateagile_1 | info: TeslaMateAgile.PriceHelper[0] teslamateagile_1 | Calculated cost 52.29 and energy 14.74 kWh for charging process 1324 teslamateagile_1 | dbug: TeslaMateAgile.PriceService[0] teslamateagile_1 | Price update complete

MattJeanes commented 1 year ago

Fantastic to hear! Thanks, I'll close this off then 🙂