Skip to content

Commit 6636940

Browse files
authored
Merge pull request #225 from MTrab/Fixing-tariff-in-cents
Fixing bug in cents calculations when using auto tariffs
2 parents 8651a6b + 6af55af commit 6636940

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

custom_components/energidataservice/sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,6 @@ def inner(*args, **kwargs): # type: ignore pylint: disable=unused-argument
579579
template_value + (value / UNIT_TO_MULTIPLIER[self._price_type])
580580
) * (float(1 + self._vat))
581581

582-
if self._cent:
583-
price = price * CENT_MULTIPLIER
584-
585582
if self._api.tariff_data is not None and hour is not None:
586583
# Add tariffs automatically
587584
try:
@@ -599,6 +596,9 @@ def inner(*args, **kwargs): # type: ignore pylint: disable=unused-argument
599596
"Error adding tariffs for %s, no valid tariffs was found!", fake_dt
600597
)
601598

599+
if self._cent:
600+
price = price * CENT_MULTIPLIER
601+
602602
return round(price, self._decimals)
603603

604604
def _format_list(

0 commit comments

Comments
 (0)