From ac73747a29910e3b92ad98b3cf2cc27b4f2f3f02 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Mon, 20 Mar 2023 18:05:43 +0100 Subject: [PATCH] Fix #723: For some reason, a space was added before 1 digit numbers --- src/MqttHandleInverter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MqttHandleInverter.cpp b/src/MqttHandleInverter.cpp index 67196fec..daba917b 100644 --- a/src/MqttHandleInverter.cpp +++ b/src/MqttHandleInverter.cpp @@ -126,9 +126,12 @@ void MqttHandleInverterClass::publishField(std::shared_ptr inv return; } - MqttSettings.publish(topic, String( + String value = String( inv->Statistics()->getChannelFieldValue(type, channel, fieldId), - static_cast(inv->Statistics()->getChannelFieldDigits(type, channel, fieldId)))); + static_cast(inv->Statistics()->getChannelFieldDigits(type, channel, fieldId))); + value.trim(); + + MqttSettings.publish(topic, value); } String MqttHandleInverterClass::getTopic(std::shared_ptr inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)