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

Problem going from Octopus Agile to Go #18

Closed
IMgoRt opened this issue Apr 14, 2021 · 13 comments
Closed

Problem going from Octopus Agile to Go #18

IMgoRt opened this issue Apr 14, 2021 · 13 comments

Comments

@IMgoRt
Copy link

IMgoRt commented Apr 14, 2021

Hi Matt,
I was on Octopus Agile which worked correctly, I've now moved to Go Faster.
I have edited the yml as follows:

      - TeslaMate__UpdateIntervalSeconds=300
      - TeslaMate__GeofenceId=1
      - TeslaMate__Phases=1
      - TeslaMate_EnergyProvider=FixedPrice
      - FixedPrice__TimeZone=Europe/London
      - FixedPrice__Prices__0=00:00-20:30=13.8
      - FixedPrice__Prices__1=20:30-23:30=4.5
      - FixedPrice__Prices__2=23:30-23:59=13.8

but I receive the following error:

Microsoft.Extensions.Options.OptionsValidationException: DataAnnotation validation failed for members: 'RegionCode' with the error: 'The RegionCode field is required.

If I add in the region_code field I previously had then the pricing is derived from the Octopus API lookup ignoring the FixedPrice option.

Thanks

@MattJeanes
Copy link
Owner

You look to only have one underscore in the environment variable for EnergyProvider so TeslaMateAgile is defaulting to Octopus Agile integration, it should be TeslaMate__EnergyProvider

@MattJeanes
Copy link
Owner

Additionally the prices configuration should wrap all the way around 24 hours so set that last one to 00:00 instead of 23:59 🙂

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

You look to only have one underscore in the environment variable for EnergyProvider so TeslaMateAgile is defaulting to Octopus Agile integration, it should be TeslaMate__EnergyProvider

So it was just luck that it worked previously ;-)

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

Additionally the prices configuration should wrap all the way around 24 hours so set that last one to 00:00 instead of 23:59 🙂

I wasn't sure

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

Thanks Matt, closed due to poor eyesight

@IMgoRt IMgoRt closed this as completed Apr 14, 2021
@MattJeanes
Copy link
Owner

Glad I could help! As an additional tip you only actually need 2 price configurations for this scenario as the times can go beyond midnight, in your case it could be:

      - FixedPrice__Prices__0=23:30-20:30=13.8
      - FixedPrice__Prices__1=20:30-23:30=4.5

It will work perfectly fine how you have it now just an fyi 🙂

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

Glad I could help! As an additional tip you only actually need 2 price configurations for this scenario as the times can go beyond midnight, in your case it could be:

      - FixedPrice__Prices__0=23:30-20:30=13.8
      - FixedPrice__Prices__1=20:30-23:30=4.5

It will work perfectly fine how you have it now just an fyi 🙂

I tried that originally, but it wasn't working for the lack of an underscore

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

OK, something's gone horribly wrong, i get the cost calculation returning the following:

Calculating cost for charges 04/13/2021 19:46:13 UTC - 04/13/2021 22:02:46 UTC 
Calculated cost 125.29 and energy 16.78 kWh for charging process 275

Which gives an effective rate of 7.467/kWh

That's using:

      - FixedPrice__Prices__0=23:30-20:30=13.8
      - FixedPrice__Prices__1=20:30-23:30=4.5

@IMgoRt IMgoRt reopened this Apr 14, 2021
@MattJeanes
Copy link
Owner

Hmm, I'm assuming this is probably a timezone issue (https://xkcd.com/1883/ 😁)

The charging times there are marked as UTC, which would make them 20:46 -> 23:02 BST, which makes the charge completely within the range of the 4.5p/kWh cost but it looks like it's calculating it as if your cost is 19:46 -> 22:02 BST which would result in approximately that cost.

Would you be able to export the relevant data from the charging_processes and charges tables for this charging session and send it to me? Check out the troubleshooting section of the README for a little more info on how to access the database if you're not sure. I also noted in this comment how to do it as well #17 (comment)

There is no personal information in those tables as location data for example is stored in a different table but be sure to read the output before sending it over just in case!

I'll use the data to replicate the issue and prepare a fix, and if you're happy include it in the unit tests for this project.

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

Hmm, I'm assuming this is probably a timezone issue (https://xkcd.com/1883/ 😁)

The charging times there are marked as UTC, which would make them 20:46 -> 23:02 BST, which makes the charge completely within the range of the 4.5p/kWh cost but it looks like it's calculating it as if your cost is 19:46 -> 22:02 BST which would result in approximately that cost.

Would you be able to export the relevant data from the charging_processes and charges tables for this charging session and send it to me? Check out the troubleshooting section of the README for a little more info on how to access the database if you're not sure. I also noted in this comment how to do it as well #17 (comment)

There is no personal information in those tables as location data for example is stored in a different table but be sure to read the output before sending it over just in case!

I'll use the data to replicate the issue and prepare a fix, and if you're happy include it in the unit tests for this project.

Sent, more than happy to help/give back to the community

@MattJeanes
Copy link
Owner

MattJeanes commented Apr 14, 2021

Thank you very much! I have tracked down the issue and fixed it, now released with version v1.5.1

Please update your TeslaMateAgile, and set the cost for this charge (and any other affected charges) in the charging_process table to NULL and it should pick them back up within 5 minutes!

With your provided data I calculated a cost of 75.5p with 16.78kWh of energy, which comes out to 4.5p/kWh.

Let me know how it goes, fingers crossed everything works perfectly!

@IMgoRt
Copy link
Author

IMgoRt commented Apr 14, 2021

Thank you very much! I have tracked down the issue and fixed it, now released with version v1.5.1

Please update your TeslaMateAgile, and set the cost for this charge (and any other affected charges) in the charging_process table to NULL and it should pick them back up within 5 minutes!

With your provided data I calculated a cost of 75.5p with 16.78kWh of energy, which comes out to 4.5p/kWh.

Let me know how it goes, fingers crossed everything works perfectly!

Thanks Matt, tested and all working

Thanks for your great work and support

@IMgoRt IMgoRt closed this as completed Apr 14, 2021
@MattJeanes
Copy link
Owner

That's great to hear! By the way I'll be publishing another new version shortly as all of this has reminded me to upgrade to .NET 5!

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