Skip to content
Merged
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
13 changes: 9 additions & 4 deletions packages/modules/chargepoints/mqtt/chargepoint_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ def on_message(client, userdata, message):
received_topics = {}
BrokerClient(f"subscribeMqttChargepointInit{self.config.id}",
on_connect, on_message).start_finite_loop()
for topic, value in received_topics.items():
if "/set/phases_to_use" in topic:
break
phases_to_use = received_topics.get(f"openWB/mqtt/chargepoint/{self.config.id}/set/phases_to_use")

if phases_to_use == 0:
phases_in_use = received_topics.get(f"openWB/mqtt/chargepoint/{self.config.id}/get/phases_in_use")
Pub().pub(
f"openWB/mqtt/chargepoint/{self.config.id}/set/phases_to_use",
phases_in_use if phases_in_use is not None else 3
)
else:
Pub().pub(f"openWB/mqtt/chargepoint/{self.config.id}/set/phases_to_use", 0)
Pub().pub(f"openWB/mqtt/chargepoint/{self.config.id}/set/phases_to_use", 3)

def set_current(self, current: float) -> None:
Pub().pub(f"openWB/mqtt/chargepoint/{self.config.id}/set/current", current)
Expand Down