MattJeanes / TeslaMateAgile

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

TeslaMateAgile.PriceHelper Tibber fail #57

Closed Check834 closed 1 month ago

Check834 commented 1 month ago

Hi there, I'm getting these errors.

info: TeslaMateAgile.PriceHelper[0] Calculating cost for charges 05/20/2024 11:07:00 UTC - 05/20/2024 13:46:31 UTC

fail: TeslaMateAgile.PriceHelper[0] Failed to calculate charging cost / energy for charging process 10 System.Exception: Mismatch of requested price info from Tibber API (expected: 4, actual: 0) at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 122 at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 96 at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 74

info: TeslaMateAgile.PriceHelper[0] Calculating cost for charges 05/20/2024 19:06:15 UTC - 05/20/2024 19:10:38 UTC

fail: TeslaMateAgile.PriceHelper[0] Failed to calculate charging cost / energy for charging process 11 System.Exception: Mismatch of requested price info from Tibber API (expected: 2, actual: 0) at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 122 at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 96 at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 74

info: TeslaMateAgile.PriceHelper[0] Calculating cost for charges 05/21/2024 04:16:08 UTC - 05/21/2024 04:20:19 UTC

fail: TeslaMateAgile.PriceHelper[0] Failed to calculate charging cost / energy for charging process 12 System.Exception: Mismatch of requested price info from Tibber API (expected: 2, actual: 0) at TeslaMateAgile.Services.TibberService.GetPriceData(DateTimeOffset from, DateTimeOffset to) in /src/TeslaMateAgile/Services/TibberService.cs:line 122 at TeslaMateAgile.PriceHelper.CalculateChargeCost(IEnumerable`1 charges) in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 96 at TeslaMateAgile.PriceHelper.Update() in /src/TeslaMateAgile/Helpers/PriceHelper.cs:line 74

MattJeanes commented 1 month ago

Hello! Looking at your first example there I plugged those exact same dates into my query and ran it and it seemed to return 4 as expected on my end:

image

I am however using their demo token. It's possible maybe you have an incorrect / expired Tibber API token or that they were having issues at this time.

If you go to the Tibber API explorer and put in the following query you can try it yourself with your own token: https://developer.tibber.com/explorer

{
  viewer {
    homes {
      id
      currentSubscription {
        priceInfo {
          range(
            resolution: HOURLY
            after: "MjAyNC0wNS0yMFQxMDowNzowMC4wMDAwMDAwKzAwOjAw"
            first: 4
          ) {
            nodes {
              total
              startsAt
            }
          }
          current {
            total
            startsAt
            level
          }
        }
      }
    }
  }
}

You can see here at least with the demo token it is working as expected:

image

Hope this helps 🙂

Check834 commented 1 month ago

Hi Matt,

I used your query and got only one entry with my token but 4 with the demo token. IMG_0259

I will now inquire about the error with Tibber support, as instead of the 4 values, only one value is being output with the personal token.

MattJeanes commented 1 month ago

Weird! I'm very curious to see what Tibber's support say about this, keep me posted!

Check834 commented 1 month ago

I've got an answer from Tibber support. The API returns only one key because the contract is not started yet. They said as soon as the contract starts it should return the whole data. I will have a look then again.

Maybe they can return charging cost soon because they changed to smart charging 2.0 feature.

MattJeanes commented 1 month ago

Interesting, good to know thanks for the update!