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

smarthome power optional excluded from home consumption #1562

Merged
merged 1 commit into from
Apr 17, 2024
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
3 changes: 2 additions & 1 deletion packages/control/counter_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def config_factory() -> Config:
class Set:
loadmanagement_active: bool = False
home_consumption: float = 0
smarthome_power_excluded_from_home_consumption: float = 0
invalid_home_consumption: int = 0
daily_yield_home_consumption: float = 0
imported_home_consumption: float = 0
Expand Down Expand Up @@ -143,7 +144,7 @@ def _calc_home_consumption(self) -> Tuple[float, List]:
elif element["type"] == ComponentType.INVERTER.value:
power += data.data.pv_data[f"pv{element['id']}"].data.get.power
evu = data.data.counter_data[self.get_evu_counter_str()].data.get.power
return evu - power, elements_to_sum_up
return evu - power - self.data.set.smarthome_power_excluded_from_home_consumption, elements_to_sum_up

def _add_hybrid_bat(self, id: int) -> List:
elements = []
Expand Down
20 changes: 20 additions & 0 deletions packages/helpermodules/subdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def on_connect(self, client: mqtt.Client, userdata, flags: dict, rc: int):
("openWB/system/backup_cloud/#", 2),
("openWB/system/device/module_update_completed", 2),
("openWB/system/device/+/config", 2),
("openWB/LegacySmartHome/Status/wattnichtHaus", 2),
])
Pub().pub("openWB/system/subdata_initialized", True)

Expand Down Expand Up @@ -177,6 +178,8 @@ def on_message(self, client: mqtt.Client, userdata, msg: mqtt.MQTTMessage):
self.process_counter_topic(self.counter_data, msg)
elif "openWB/system/" in msg.topic:
self.process_system_topic(client, self.system_data, msg)
elif "openWB/LegacySmartHome/" in msg.topic:
self.process_legacy_smarthome_topic_topic(client, self.counter_all_data, msg)
elif "openWB/command/command_completed" == msg.topic:
self.event_command_completed.set()
else:
Expand Down Expand Up @@ -859,3 +862,20 @@ def set_internal_chargepoint_configured(self):
else:
internal_configured = False
self.internal_chargepoint_data["global_data"].configured = internal_configured

def process_legacy_smarthome_topic_topic(self, client, var: counter_all.CounterAll, msg: mqtt.MQTTMessage):
""" Handler für die Graph-Topics

Parameter
----------
var : Dictionary
enthält aktuelle Daten
msg :
enthält Topic und Payload
"""
try:
if "openWB/LegacySmartHome/Status/wattnichtHaus" == msg.topic:
# keine automatische Zuordnung, da das Topic anders heißt als der Wert in der Datenstruktur
var.data.set.smarthome_power_excluded_from_home_consumption = decode_payload(msg.payload)
except Exception:
log.exception("Fehler im subdata-Modul")