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
3 changes: 2 additions & 1 deletion packages/helpermodules/setdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ def process_pv_topic(self, msg: mqtt.MQTTMessage):
"/get/yearly_exported" in msg.topic or
"/get/energy" in msg.topic):
self._validate_value(msg, float, [(0, float("inf"))])
elif "/get/exported" in msg.topic:
elif ("/get/exported" in msg.topic or
"/get/imported" in msg.topic):
self._validate_value(msg, float, [(0, float("inf"))])
elif "/get/power" in msg.topic:
self._validate_value(msg, float)
Expand Down
4 changes: 2 additions & 2 deletions packages/modules/devices/generic/mqtt/bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def parse_received_topics(value: str):
currents = parse_received_topics("currents")
power = received_topics[f"{topic_prefix}power"]
soc = received_topics[f"{topic_prefix}soc"]
if (received_topics.get(f"{topic_prefix}imported") and
received_topics.get(f"{topic_prefix}exported")):
if (received_topics.get(f"{topic_prefix}imported") is not None and
received_topics.get(f"{topic_prefix}exported") is not None):
imported = received_topics[f"{topic_prefix}imported"]
exported = received_topics[f"{topic_prefix}exported"]
else:
Expand Down
12 changes: 9 additions & 3 deletions packages/modules/devices/generic/mqtt/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ def parse_received_topics(value: str):
# [] für erforderliche Topics, .get() für optionale Topics
topic_prefix = f"openWB/mqtt/pv/{self.component_config.id}/get/"
power = received_topics[f"{topic_prefix}power"]
if received_topics.get(f"openWB/mqtt/pv/{self.component_config.id}/get/exported"):

if (received_topics.get(f"{topic_prefix}exported") is None or
received_topics.get(f"{topic_prefix}imported") is None):
imported, exported = self.sim_counter.sim_count(power)
if received_topics.get(f"{topic_prefix}exported"):
exported = received_topics[f"{topic_prefix}exported"]
else:
exported = self.sim_counter.sim_count(power)[1]
if received_topics.get(f"{topic_prefix}imported"):
imported = received_topics[f"{topic_prefix}imported"]

currents = parse_received_topics("currents")
dc_power = parse_received_topics("dc_power")

inverter_state = InverterState(
currents=currents,
power=power,
exported=exported,
imported=imported,
dc_power=dc_power
)
self.store.set(inverter_state)
Expand Down