File tree Expand file tree Collapse file tree
modules/devices/generic/mqtt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -610,7 +610,8 @@ def process_pv_topic(self, msg: mqtt.MQTTMessage):
610610 "/get/yearly_exported" in msg .topic or
611611 "/get/energy" in msg .topic ):
612612 self ._validate_value (msg , float , [(0 , float ("inf" ))])
613- elif "/get/exported" in msg .topic :
613+ elif ("/get/exported" in msg .topic or
614+ "/get/imported" in msg .topic ):
614615 self ._validate_value (msg , float , [(0 , float ("inf" ))])
615616 elif "/get/power" in msg .topic :
616617 self ._validate_value (msg , float )
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ def parse_received_topics(value: str):
3434 currents = parse_received_topics ("currents" )
3535 power = received_topics [f"{ topic_prefix } power" ]
3636 soc = received_topics [f"{ topic_prefix } soc" ]
37- if (received_topics .get (f"{ topic_prefix } imported" ) and
38- received_topics .get (f"{ topic_prefix } exported" )):
37+ if (received_topics .get (f"{ topic_prefix } imported" ) is not None and
38+ received_topics .get (f"{ topic_prefix } exported" ) is not None ):
3939 imported = received_topics [f"{ topic_prefix } imported" ]
4040 exported = received_topics [f"{ topic_prefix } exported" ]
4141 else :
Original file line number Diff line number Diff line change @@ -31,17 +31,23 @@ def parse_received_topics(value: str):
3131 # [] für erforderliche Topics, .get() für optionale Topics
3232 topic_prefix = f"openWB/mqtt/pv/{ self .component_config .id } /get/"
3333 power = received_topics [f"{ topic_prefix } power" ]
34- if received_topics .get (f"openWB/mqtt/pv/{ self .component_config .id } /get/exported" ):
34+
35+ if (received_topics .get (f"{ topic_prefix } exported" ) is None or
36+ received_topics .get (f"{ topic_prefix } imported" ) is None ):
37+ imported , exported = self .sim_counter .sim_count (power )
38+ if received_topics .get (f"{ topic_prefix } exported" ):
3539 exported = received_topics [f"{ topic_prefix } exported" ]
36- else :
37- exported = self .sim_counter .sim_count (power )[1 ]
40+ if received_topics .get (f"{ topic_prefix } imported" ):
41+ imported = received_topics [f"{ topic_prefix } imported" ]
42+
3843 currents = parse_received_topics ("currents" )
3944 dc_power = parse_received_topics ("dc_power" )
4045
4146 inverter_state = InverterState (
4247 currents = currents ,
4348 power = power ,
4449 exported = exported ,
50+ imported = imported ,
4551 dc_power = dc_power
4652 )
4753 self .store .set (inverter_state )
You can’t perform that action at this time.
0 commit comments