Skip to content

Commit

Permalink
Fixing MQTT current values
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisBrock committed Sep 19, 2024
1 parent 71cb525 commit 44b4b98
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Components/MQTT/MQTTManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,21 @@ namespace MQTTManager
break;
case (MqttPublishedValues::ChargingCurrent):
float c1, c2, c3;
gWallbox->GetChargingCurrents(c1, c2, c3);
gMqttClient.publish("heidelbridge/charging_current/phase1", 0, false, String(c1).c_str());
gMqttClient.publish("heidelbridge/charging_current/phase2", 0, false, String(c2).c_str());
gMqttClient.publish("heidelbridge/charging_current/phase3", 0, false, String(c3).c_str());
if (gWallbox->GetChargingCurrents(c1, c2, c3))
{
gMqttClient.publish("heidelbridge/charging_current/phase1", 0, false, String(c1).c_str());
gMqttClient.publish("heidelbridge/charging_current/phase2", 0, false, String(c2).c_str());
gMqttClient.publish("heidelbridge/charging_current/phase3", 0, false, String(c3).c_str());
}
break;
case (MqttPublishedValues::ChargingVoltage):
float v1, v2, v3;
gWallbox->GetChargingVoltages(v1, v2, v3);
gMqttClient.publish("heidelbridge/charging_voltage/phase1", 0, false, String(v1).c_str());
gMqttClient.publish("heidelbridge/charging_voltage/phase2", 0, false, String(v2).c_str());
gMqttClient.publish("heidelbridge/charging_voltage/phase3", 0, false, String(v3).c_str());
if (gWallbox->GetChargingVoltages(v1, v2, v3))
{
gMqttClient.publish("heidelbridge/charging_voltage/phase1", 0, false, String(v1).c_str());
gMqttClient.publish("heidelbridge/charging_voltage/phase2", 0, false, String(v2).c_str());
gMqttClient.publish("heidelbridge/charging_voltage/phase3", 0, false, String(v3).c_str());
}
break;
}
gCurValueIndex = (gCurValueIndex + 1) % NumMqttPublishedValues;
Expand Down

0 comments on commit 44b4b98

Please sign in to comment.