Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/helpermodules/measurement_logging/process_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def calc_energy_imported_by_source(energy_imported, energy_source):
entry["cp"][key][f"energy_imported_{source}"] = calc_energy_imported_by_source(
entry["cp"][key]["energy_imported"], entry["energy_source"][source])
for counter in entry["counter"].values():
if counter["exported"] == 0:
if counter["grid"] is False:
counter[f"energy_imported_{source}"] = calc_energy_imported_by_source(
counter["energy_imported"], entry["energy_source"][source])

Expand Down
16 changes: 16 additions & 0 deletions packages/helpermodules/measurement_logging/write_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
# {
# "timestamp": int,
# "date": str,
# "prices": {
# "grid": Preis für Netzbezug,
# "pv": Preis für PV-Strom,
# "bat": Preis für Speicherstrom
# }
# "cp": {
# "cp1": {
# "imported": Zählerstand in Wh,
Expand Down Expand Up @@ -190,6 +195,16 @@ def create_entry(log_type: LogType, sh_log_data: LegacySmartHomeLogData, previou
else:
date = timecheck.create_timestamp_YYYYMMDD()
current_timestamp = int(timecheck.create_timestamp())

prices = data.data.general_data.data.prices
if data.data.optional_data.et_module is not None:
grid_price = data.data.optional_data.et_get_current_price()
else:
grid_price = prices.grid
prices_dict = {"grid": grid_price,
"pv": prices.pv,
"bat": prices.bat}

cp_dict = {}
for cp in data.data.cp_data:
try:
Expand Down Expand Up @@ -252,6 +267,7 @@ def create_entry(log_type: LogType, sh_log_data: LegacySmartHomeLogData, previou
new_entry = {
"timestamp": current_timestamp,
"date": date,
"prices": prices_dict,
"cp": cp_dict,
"ev": ev_dict,
"counter": counter_dict,
Expand Down