# Berrechnung Tarif Awattar

**URL:** <https://community-smarthome.com/t/berrechnung-tarif-awattar/5455>\
**Category:** EVCC\
**Created:** [4. April 2025 um 16:56 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455 "2025-04-04T16:56:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![KingJosef](https://community-smarthome.com/user_avatar/community-smarthome.com/kingjosef/32/459_2.png) [@KingJosef](https://community-smarthome.com/u/KingJosef)\
**Post date:** [4. April 2025 um 16:56 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/1 "2025-04-04T16:56:46Z")

</div>

abend

das Beispiel lautet

```auto
tariffs:
  grid:
    type: template
    template: awattar
    region: AT # [DE, AT] (optional)
    charges: # Zusätzlicher fester Aufschlag pro kWh (z.B. 0.05 für 5 Cent) (optional)
    tax: # Zusätzlicher prozentualer Aufschlag (z.B. 0.2 für 20%) (optional)
    formula: math.Max((price + charges) * (1 + tax), 0.0) # Individuelle Formel zur Berechnung des Preises (optional

```

wie kann man Berechnen ,da wenn man nach diese Formula vorgeht das Ergenis nicht richtig ist

Stündliche Preise +3% =xxxx +1,5cent = xxxxx +20%

danke

---

<div class="post-metadata">

**Author:** ![jayjojayson](https://community-smarthome.com/user_avatar/community-smarthome.com/jayjojayson/32/639_2.png) [@jayjojayson](https://community-smarthome.com/u/jayjojayson)\
**Post date:** [4. April 2025 um 17:50 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/2 "2025-04-04T17:50:50Z")

</div>

Hi, du kannst doch in deinem Beispiel die beiden Sachen für charges und tax ausfüllen, zumindest laut der Info die dahinter steht. charges wären dann die 1,5 cent Aufschlag und tax der Steueraufschlag von 20%. Die 3% müssten noch manuell hinzugefügt und die Formel angepasst werden. Woher kommt prices? Der Sensor kommt von awattar?

Habe deine Formel einfach mal versucht umzuschreiben. So ganz klar ist die mir aber nicht. Du rechnest die stündlichen Preis + 3% und + 1,5cent. Wieso noch die 1,5 cent?

`Stündliche Preise +3% =xxxx +1,5cent = xxxxx +20%`

```auto
formula: math.Max((price * 1.03 + charges) * (1 + tax), 0.0)

```

```auto
tariffs:
  grid:
    type: template
    template: awattar
    region: AT # [DE, AT] (optional)
    charges: 0.015 # 1,5 Cent
    tax: 0.20 # 20%
    formula: math.Max((price * 1.03 + charges) * (1 + tax), 0.0)

```

---

<div class="post-metadata">

**Author:** ![KingJosef](https://community-smarthome.com/user_avatar/community-smarthome.com/kingjosef/32/459_2.png) [@KingJosef](https://community-smarthome.com/u/KingJosef)\
**Post date:** [4. April 2025 um 18:13 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/3 "2025-04-04T18:13:30Z")

</div>

da das ganze von evcc vorgegeben wurde denl ich das es von awattar kommt

das ist die Berechnung von Awattar , daher auch die 1,5 cent

 ![image](https://community-smarthome.com/uploads/default/original/2X/a/a493bf604e279f3abe720f0a2ec39ae83d10200c.png)

---

<div class="post-metadata">

**Author:** ![jayjojayson](https://community-smarthome.com/user_avatar/community-smarthome.com/jayjojayson/32/639_2.png) [@jayjojayson](https://community-smarthome.com/u/jayjojayson)\
**Post date:** [4. April 2025 um 18:17 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/4 "2025-04-04T18:17:07Z")

</div>

Ok, dann sollte die Formel passen, teste mal.

---

<div class="post-metadata">

**Author:** ![KingJosef](https://community-smarthome.com/user_avatar/community-smarthome.com/kingjosef/32/459_2.png) [@KingJosef](https://community-smarthome.com/u/KingJosef)\
**Post date:** [4. April 2025 um 18:27 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/5 "2025-04-04T18:27:36Z")

</div>

sags ungern , aber geil es passt 👌

---

<div class="post-metadata">

**Author:** ![mafe68](https://community-smarthome.com/user_avatar/community-smarthome.com/mafe68/32/3049_2.png) [@mafe68](https://community-smarthome.com/u/mafe68)\
**Post date:** [6. April 2025 um 08:32 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/6 "2025-04-06T08:32:43Z")

</div>

Habe hier auch die Formel, nur ist mir gearde aufgefallen, dass er jetzt keine Negativpreise mehr anzeigt! Wenn der Preis Negativ ist, dann wird nur 0,0 Cent angezeigt. Wenn ich die Formel raus geben dann werden auch Negativpreise angezeigt. Kann man da noch was verfeinern, dass er auch die Negativpreise anzeigt?

---

<div class="post-metadata">

**Author:** ![jayjojayson](https://community-smarthome.com/user_avatar/community-smarthome.com/jayjojayson/32/639_2.png) [@jayjojayson](https://community-smarthome.com/u/jayjojayson)\
**Post date:** [6. April 2025 um 08:38 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/7 "2025-04-06T08:38:40Z")

</div>

Moin, dann lasst mal das `math.Max` vor der Formel weg, so sollten auch negative Werte errechnet werden können (wird dann direkt berechnet).

```yaml
formula: (price * 1.03 + charges) * (1 + tax)

```

---

<div class="post-metadata">

**Author:** ![mafe68](https://community-smarthome.com/user_avatar/community-smarthome.com/mafe68/32/3049_2.png) [@mafe68](https://community-smarthome.com/u/mafe68)\
**Post date:** [6. April 2025 um 08:57 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/8 "2025-04-06T08:57:16Z")

</div>

Genau das war es! Super Danke!  
Hast du zufällig wo eine Anleitung wo man so was nachlesen kann, wie so ein Code aufgebaut wird! Will nicht nur das einfach nur dumm ändern ohne zu Wissen was das macht. Möchte das ganze auch verstehen lernen.  
Dazu bist du der richtige Profi! 🙂

---

<div class="post-metadata">

**Author:** ![jayjojayson](https://community-smarthome.com/user_avatar/community-smarthome.com/jayjojayson/32/639_2.png) [@jayjojayson](https://community-smarthome.com/u/jayjojayson)\
**Post date:** [6. April 2025 um 09:10 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/9 "2025-04-06T09:10:13Z")

</div>

Ich bin auch kein Profi… 😉  
Wo man das jetzt so auf die schnelle nachlesen kann, weiß ich nicht. Aber ich kann es erklären. math.Max ist eine Funktion, also so etwas wie in Excel eine Summe bilden, da steht dann auch Summe(xx;xx) als Formel in der Zeile. So kannst du dir das hier auch vorstellen und math.Max vergleicht nun das Ergebnis der Formel und gibt den größeren Wert aus (daher Max).

In der alten Formel stand hinten noch das 0.0 dran und das war der Max-Wert, daher konnte nur max 0 herauskommen. lässt man den Math teil weg, kann die Formel direkt ausgerechnet werden und es wird daher auch der negativ Wert angegeben.

Vergleich bei math.Max  
`math.Max(-0.05, 0.0) = 0.0`

ohne Vergleich  
`(-0.05) = -0.05`

Hoffe das einigermaßen verständlich ausgedrückt zu haben. 🙂

---

<div class="post-metadata">

**Author:** ![KingJosef](https://community-smarthome.com/user_avatar/community-smarthome.com/kingjosef/32/459_2.png) [@KingJosef](https://community-smarthome.com/u/KingJosef)\
**Post date:** [6. April 2025 um 09:13 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/10 "2025-04-06T09:13:34Z")

</div>

müsste man auch denen von evcc mitteilen , die haben ja die Musterconfig auf ihrer HP

---

<div class="post-metadata">

**Author:** ![mafe68](https://community-smarthome.com/user_avatar/community-smarthome.com/mafe68/32/3049_2.png) [@mafe68](https://community-smarthome.com/u/mafe68)\
**Post date:** [6. April 2025 um 09:13 UTC](https://community-smarthome.com/t/berrechnung-tarif-awattar/5455/11 "2025-04-06T09:13:56Z")

</div>

Danke für die Erklärung, ja das war verständlich!  
Der Code ist ein JSON Code wenn ich das jetzt richtig sehe, dann werde ich mir mal wo die Grundlagen raus suchen und damit anfangen.
