Skip to content

Commit

Permalink
Fix value of kwh
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Aug 30, 2023
1 parent 520c377 commit f338f09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.2.b4
0.9.2.b5
16 changes: 8 additions & 8 deletions app/models/export_home_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def truncate(f, n):

def convert_price(price):
if type(price) == str:
price = float(price.replace(",", "."))
return "{:.4f}".format(price / 100)
price = price.replace(",", ".")
return float(price)


class HomeAssistant:
Expand Down Expand Up @@ -394,14 +394,14 @@ def myelectricaldata_usage_point_id(self, measurement_direction):
dailyweek_HP.append(convert_kw(hp))
dailyweek_HC.append(convert_kw(hc))
cost_hp = (
convert_kw_to_euro(tempo_data["blue_hp"], tempo_config["blue_hp"])
+ convert_kw_to_euro(tempo_data["white_hp"], tempo_config["white_hp"])
+ convert_kw_to_euro(tempo_data["red_hp"], tempo_config["red_hp"])
convert_kw_to_euro(tempo_data["blue_hp"], convert_price(tempo_config["blue_hp"]))
+ convert_kw_to_euro(tempo_data["white_hp"], convert_price(tempo_config["white_hp"]))
+ convert_kw_to_euro(tempo_data["red_hp"], convert_price(tempo_config["red_hp"]))
)
cost_hc = (
convert_kw_to_euro(tempo_data["blue_hc"], tempo_config["blue_hc"])
+ convert_kw_to_euro(tempo_data["white_hc"], tempo_config["white_hc"])
+ convert_kw_to_euro(tempo_data["red_hc"], tempo_config["red_hc"])
convert_kw_to_euro(tempo_data["blue_hc"], convert_price(tempo_config["blue_hc"]))
+ convert_kw_to_euro(tempo_data["white_hc"], convert_price(tempo_config["white_hc"]))
+ convert_kw_to_euro(tempo_data["red_hc"], convert_price(tempo_config["red_hc"]))
)
dailyweek_costHP.append(cost_hp)
dailyweek_costHC.append(cost_hc)
Expand Down

0 comments on commit f338f09

Please sign in to comment.