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

Tariffs: add formulas #17002

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Tariffs: add formulas #17002

merged 3 commits into from
Nov 6, 2024

Conversation

andig
Copy link
Member

@andig andig commented Oct 31, 2024

Fix #16977

Available Variables: price, charges, tax, math (go package)

Examples: Raw spot price with 0ct lower cap and 50ct upper cap

  grid:
    type: template
    template: energy-charts-api
    bzn: DE-LU
    formula: Math.Min(math.Max(price, 0), 0.5)

TODO

  • add to templates

@andig andig requested a review from naltatis October 31, 2024 09:54
@andig andig added the tariffs Specific tariff support label Oct 31, 2024
@naltatis naltatis added the needs documentation Triggers issue creation in evcc-io/docs label Nov 5, 2024
Copy link
Member

@naltatis naltatis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hab das gerade getestet. Sieht gut aus.

@andig andig merged commit bb8bf49 into master Nov 6, 2024
8 checks passed
@andig andig deleted the feat/tariff-formulas branch November 6, 2024 14:17
@andi0b
Copy link
Contributor

andi0b commented Nov 8, 2024

@andig Großartig, danke!

charges und tax scheinen jedoch nicht übergeben zu werden und sind immer 0.0.

evcc/tariff/embed.go

Lines 42 to 45 in 1de1548

t.calc = func(price float64) (float64, error) {
if _, err := vm.Eval(fmt.Sprintf("price = %f", price)); err != nil {
return 0, err
}

@andig
Copy link
Member Author

andig commented Nov 8, 2024

Fixed in master

@timpetersson81
Copy link

@andig does this allow me to add zone based tariffs to the dynamic electricity prices?

@andig
Copy link
Member Author

andig commented Nov 10, 2024

No :(

mabunixda added a commit to mabunixda/evcc that referenced this pull request Nov 22, 2024
* master: (102 commits)
  Smart Cost: better option steps (evcc-io#17117)
  Add Peblar (evcc-io#16451)
  Smart Cost: higher precision limit via slot click (evcc-io#17099)
  Tariffs: add formulas (evcc-io#17002)
  Volvo2mqtt: remove broken status (evcc-io#17089)
  chore: generalise handlers
  chore: clean error handling
  Mqtt: fix panic
  Ui: restore semi-legacy browser support (evcc-io#17061)
  chore: assert plugin getters (evcc-io#17052)
  Revert "Allow meters for pv usage (evcc-io#17006)"
  Em2Go: work around current being reset (evcc-io#17050)
  Upgrade telegram api (evcc-io#17049)
  chore: use cast.ToBoolE (evcc-io#17030)
  chore: deduplicate getter implementations (evcc-io#17031)
  Plugins: make script plugin use pipeline (evcc-io#17029)
  chore: fix test
  Site: don't modify battery mode unless battery configured (evcc-io#17027)
  chore: rebuild mocks
  chore: upgrade libraries
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs documentation Triggers issue creation in evcc-io/docs tariffs Specific tariff support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tariffs: improve flexibility
4 participants