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

Grid type octpusenergy key is called "tariff" but only accepts "product" #13474

Closed
teun95 opened this issue Apr 17, 2024 · 7 comments · Fixed by #13637
Closed

Grid type octpusenergy key is called "tariff" but only accepts "product" #13474

teun95 opened this issue Apr 17, 2024 · 7 comments · Fixed by #13637
Labels
question Rather clarification than issue

Comments

@teun95
Copy link

teun95 commented Apr 17, 2024

Describe the bug

The grid type octopusenergy has the key tariff, but when the tariff code is used an error is displayed in the log. When the product code is used, the configuration works without issues.

Octopus Energy has tariff codes and product codes, which conflicts with how the terminology is used in EVCC. If Octopus Energy would not have had tariff codes, users would not have been confused and would use product codes as value for tariff. However, given that looking up a Octopus Energy product code will also expose the user to the tariff code, the error is the result of expected configuration changes.

For clarification, this is from the API reference of Octopus Energy.

product_code

    The code of the product to be retrieved, for example VAR-17-01-11.
tariff_code

    The code of the tariff to be retrieved, for example E-1R-VAR-17-01-11-A.

As you can see, the tariff code is made up of the product code with some additional stuff. I believe that EVCC actually obtains the tariff code using the product code.

Steps to reproduce

  1. Configure octopusenergy as grid type
  2. Use the tariff code E-1R-COSY-22-12-08-A as value for tariff

Configuration details

tariffs:
  currency: GBP
  grid:
    type: octopusenergy
    tariff: E-1R-COSY-22-12-08-A # Tariff code
    region: A # optional

Log details

**Log output when using `E-1R-COSY-22-12-08-A` as value for `tariff`:**


[octopus] ERROR 2024/04/17 16:01:59 unexpected status: 404 (Not Found)
[main  ] ERROR 2024/04/17 16:01:59 failed configuring grid tariff: cannot create tariff type 'octopusenergy': unexpected status: 404 (Not Found)


### What type of operating system are you running?

HomeAssistant Add-on

### Version

0.125.0
@teun95
Copy link
Author

teun95 commented Apr 17, 2024

I think there are two options for a fix:

  1. Clarify in the documentation that tariff in the case of Octopus Energy refers to the product code. I think this is undesirable as it is more of a workaround.
  2. Add an additional more specific key called tariffcode or productcodeand update /tariff/octopus/api.go to reflect this. Tariff can then be deprecated in time. I do not have enough knowledge of the octopus energy api to know whether it makes most sense to ask for the tariffcode or productcode.
  3. Add a key for the Octopus Energy api token and obtain the active tariff code in the background. This is more work, but provides a better user experience as the API key can relatively easily be found in the Octopus Energy account details whereas finding the product or tariff details is more involved.

@andig
Copy link
Member

andig commented Apr 17, 2024

Is this similar to #11555?

/cc @duckfullstop

@andig andig added the question Rather clarification than issue label Apr 17, 2024
@duckfullstop
Copy link
Contributor

It is - #11555 provides option 3

Tariff and product codes are mightily confusing to pick apart because they're referred to by similar phrases in different places - sorry for any confusion!

I'd suggest we could catch this during parsing of the code (and act appropriately), but option 2 is probably a better move for long term codebase tidiness (alongside option 3)

@andig
Copy link
Member

andig commented Apr 26, 2024

@duckfullstop would you want to follow up with the PR? Otherwise I'd close here as wontfix.

@duckfullstop
Copy link
Contributor

I'm happy to provide a fix (life permitting), but I'm not sure whether it makes more sense to add it as part of #11555, or as a separate thing?

@andig
Copy link
Member

andig commented Apr 26, 2024

As you prefer, no strong opinion here.

duckfullstop added a commit to duckfullstop/evcc that referenced this issue Apr 26, 2024
…ct Octopus parlance

Closes evcc-io#13474 - not a breaking change but deprecates 'tariff'
duckfullstop added a commit to duckfullstop/docs that referenced this issue Apr 26, 2024
@duckfullstop
Copy link
Contributor

duckfullstop commented Apr 26, 2024

I have pushed a non-breaking change from tariff to productcode to the branch, ready for review once it's unstaled (unless I broke #11555?)

(my IDE of choice has self-combusted and I'm away from home so the PR may be horribly broken as I'm only able to test with a really old version (which isn't Go 1.22 compliant), I might be able to spend some time on it next week but I'm 99.9% confident that branch works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Rather clarification than issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants