From 648e128ec022f0e5ca97d7e5d9ffc1719a817be8 Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Wed, 17 Aug 2022 09:50:37 +0200 Subject: [PATCH] fix mqtt payload for reactive power limit --- tools/esp8266/app.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 125a04ab..2d5516d3 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -459,7 +459,7 @@ void app::cbMqtt(char* topic, byte* payload, unsigned int length) { } iv->devControlRequest = true; } else { - DPRINTLN(DBG_INFO, F("Invalid mqtt payload recevied: ") + String((char*)payload)); + DPRINTLN(DBG_INFO, F("Invalid mqtt payload recevied: ") + String(std::string((char*)payload, (unsigned int)length)); } break; case TurnOn: // Turn On @@ -481,7 +481,7 @@ void app::cbMqtt(char* topic, byte* payload, unsigned int length) { iv->devControlCmd = ReactivePowerContr; if (true){ // if (std::stoi((char*)payload) > 0) error handling powerlimit needed? iv->devControlCmd = ReactivePowerContr; - iv->powerLimit[0] = std::stoi((char*)payload); + iv->powerLimit[0] = std::stoi(std::string((char*)payload, (unsigned int)length)); iv->powerLimit[1] = 0x0000; // if reactivepower limit is set via external interface --> set it temporay DPRINTLN(DBG_DEBUG, F("Reactivepower limit for inverter ") + String(iv->id) + F(" set to ") + String(iv->powerLimit[0]) + F("W") ); iv->devControlRequest = true;