From 319e5a2bbb486faac5195a0bc6aea7960a75e5a0 Mon Sep 17 00:00:00 2001 From: SoftWareCrash Date: Wed, 2 Oct 2024 13:12:46 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20IOS=2018=20Safari=20we?= =?UTF-8?q?bUI=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformio.ini | 8 ++++---- src/main.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/platformio.ini b/platformio.ini index 8c1afc9..618ab98 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ platform = espressif8266@4.2.1 framework = arduino monitor_speed = 115200 -custom_prog_version = 1.1.7 +custom_prog_version = 1.1.8 build_flags = -DVERSION=${this.custom_prog_version} -DPIO_SRC_NAM="Solar2MQTT" @@ -23,13 +23,13 @@ extra_scripts = pre:tools/mini_html.py post:tools/post_compile.py lib_deps = bblanchon/ArduinoJson @ ^6.21.2 - ottowinter/ESPAsyncTCP-esphome@^1.2.3 - ottowinter/ESPAsyncWebServer-esphome @ ^3.1.0 + esphome/ESPAsyncTCP-esphome @ 2.0.0 + mathieucarbou/ESPAsyncWebServer @ 3.3.7 + mathieucarbou/WebSerialLite@^6.2.0 alanswx/ESPAsyncWiFiManager @ ^0.31.0 plerup/EspSoftwareSerial @ ^8.2.0 https://github.com/dok-net/ghostl robtillaart/CRC@^1.0.1 - asjdf/WebSerialLite@^2.2.0 [env:d1_mini] board = d1_mini diff --git a/src/main.cpp b/src/main.cpp index 1b35cf8..5bdd69e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -327,14 +327,14 @@ void setup() server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request) { if(strlen(settings.data.httpUser) > 0 && !request->authenticate(settings.data.httpUser, settings.data.httpPass)) return request->requestAuthentication(); - AsyncWebParameter *p = request->getParam(0); - if (p->name() == "CC") - { - commandFromUser = (p->value()); + String message; + if (request->hasParam("CC")) { + message = request->getParam("CC")->value(); + commandFromUser = (message); } - if (p->name() == "ha") - { - haDiscTrigger = true; + if (request->hasParam("ha")) { + message = request->getParam("ha")->value(); + haDiscTrigger = true; } request->send(200, "text/plain", "message received"); }); From 961cf3be40e6cfd8d950091a5f9613b956207208 Mon Sep 17 00:00:00 2001 From: Oleksii Zholdak Date: Sat, 5 Oct 2024 23:35:49 +0300 Subject: [PATCH 2/2] Add QPIWS PI30 basic support: RAW answer and MQTT topic of alerts list --- src/PI_Serial/PI_Serial.cpp | 4 ++ src/PI_Serial/PI_Serial.h | 4 +- src/PI_Serial/QPIWS.h | 73 +++++++++++++++++++++++++++++++++++++ src/main.cpp | 1 + 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/PI_Serial/QPIWS.h diff --git a/src/PI_Serial/PI_Serial.cpp b/src/PI_Serial/PI_Serial.cpp index cdc40e1..d3fdf39 100644 --- a/src/PI_Serial/PI_Serial.cpp +++ b/src/PI_Serial/PI_Serial.cpp @@ -15,6 +15,7 @@ CRC16 crc; #include "QPIGS2.h" #include "QMOD.h" #include "QEX.h" +#include "QPIWS.h" extern void writeLog(const char *format, ...); //---------------------------------------------------------------------- // Public Functions @@ -92,6 +93,9 @@ bool PI_Serial::loop() requestCounter = PIXX_QEX() ? (requestCounter + 1) : 0; break; case 5: + requestCounter = PIXX_QPIWS() ? (requestCounter + 1) : 0; + break; + case 6: requestCallback(); requestCounter = 0; break; diff --git a/src/PI_Serial/PI_Serial.h b/src/PI_Serial/PI_Serial.h index 5b39ba1..f0fe1e8 100644 --- a/src/PI_Serial/PI_Serial.h +++ b/src/PI_Serial/PI_Serial.h @@ -1,7 +1,7 @@ #include "SoftwareSerial.h" #ifndef PI_SERIAL_H #define PI_SERIAL_H - +#include "vector" #include extern JsonObject deviceJson; extern JsonObject staticData; @@ -40,6 +40,7 @@ class PI_Serial String qlm; String qld; String commandAnswer; + String qpiws; } raw; } get; @@ -144,6 +145,7 @@ class PI_Serial bool PIXX_QPIGS2(); bool PIXX_QMOD(); bool PIXX_QEX(); + bool PIXX_QPIWS(); // static reqeuests bool PIXX_QPIRI(); bool PIXX_QPI(); diff --git a/src/PI_Serial/QPIWS.h b/src/PI_Serial/QPIWS.h new file mode 100644 index 0000000..d3d9416 --- /dev/null +++ b/src/PI_Serial/QPIWS.h @@ -0,0 +1,73 @@ +bool PI_Serial::PIXX_QPIWS() +{ + if (protocol == PI30) + { + String commandAnswer = this->requestData("QPIWS"); + //String commandAnswer = "10000000001010000000000000000000"; + get.raw.qpiws = commandAnswer; + byte commandAnswerLength = commandAnswer.length(); + if (commandAnswer == "NAK") + { + return true; + } + if (commandAnswer == "ERCRC") + { + return false; + } + if (commandAnswerLength == 32) + { + std::vector qpiwsStrings; + if ((char)commandAnswer.charAt(1) == '1') qpiwsStrings.emplace_back("Inverter fault"); // 2 + if ((char)commandAnswer.charAt(2) == '1') qpiwsStrings.emplace_back("Bus over fault"); // 3 + if ((char)commandAnswer.charAt(3) == '1') qpiwsStrings.emplace_back("Bus under fault"); // 4 + if ((char)commandAnswer.charAt(4) == '1') qpiwsStrings.emplace_back("Bus soft fail fault"); // 5 + if ((char)commandAnswer.charAt(5) == '1') qpiwsStrings.emplace_back("Line fail warning"); // 6 + if ((char)commandAnswer.charAt(6) == '1') qpiwsStrings.emplace_back("OPV short warning"); // 7 + if ((char)commandAnswer.charAt(7) == '1') qpiwsStrings.emplace_back("Inverter voltage too low fault"); // 8 + if ((char)commandAnswer.charAt(8) == '1') qpiwsStrings.emplace_back("Inverter voltage too high fault"); // 9 + if ((char)commandAnswer.charAt(9) == '1') qpiwsStrings.emplace_back("Over temperature fault"); // 10 + if ((char)commandAnswer.charAt(10) == '1') qpiwsStrings.emplace_back("Fan locked fault"); // 11 + if ((char)commandAnswer.charAt(11) == '1') qpiwsStrings.emplace_back("Battery voltage too high fault"); // 12 + if ((char)commandAnswer.charAt(12) == '1') qpiwsStrings.emplace_back("Battery low alarm warning"); // 13 + if ((char)commandAnswer.charAt(14) == '1') qpiwsStrings.emplace_back("Battery under shutdown warning"); // 15 + if ((char)commandAnswer.charAt(16) == '1') qpiwsStrings.emplace_back("Overload fault"); // 17 + if ((char)commandAnswer.charAt(17) == '1') qpiwsStrings.emplace_back("EEPROM fault"); // 18 + if ((char)commandAnswer.charAt(18) == '1') qpiwsStrings.emplace_back("Inverter over current fault"); // 19 + if ((char)commandAnswer.charAt(19) == '1') qpiwsStrings.emplace_back("Inverter soft fail fault"); // 20 + if ((char)commandAnswer.charAt(20) == '1') qpiwsStrings.emplace_back("Self test fail fault"); // 21 + if ((char)commandAnswer.charAt(21) == '1') qpiwsStrings.emplace_back("OP DC voltage over fault"); // 22 + if ((char)commandAnswer.charAt(22) == '1') qpiwsStrings.emplace_back("Battery open fault"); // 23 + if ((char)commandAnswer.charAt(23) == '1') qpiwsStrings.emplace_back("Current sensor fail fault"); // 24 + if ((char)commandAnswer.charAt(24) == '1') qpiwsStrings.emplace_back("Battery short fault"); // 25 + if ((char)commandAnswer.charAt(25) == '1') qpiwsStrings.emplace_back("Power limit warning"); // 26 + if ((char)commandAnswer.charAt(26) == '1') qpiwsStrings.emplace_back("PV voltage high warning"); // 27 + if ((char)commandAnswer.charAt(27) == '1') qpiwsStrings.emplace_back("MPPT overload fault"); // 28 + if ((char)commandAnswer.charAt(28) == '1') qpiwsStrings.emplace_back("MPPT overload warning"); // 29 + if ((char)commandAnswer.charAt(29) == '1') qpiwsStrings.emplace_back("Battery too low to charge warning"); // 30 + if (!qpiwsStrings.empty()) + { + String qpiwsStr = ""; + for (size_t i = 0; i < qpiwsStrings.size(); i++) { + qpiwsStr += qpiwsStrings[i]; + if (i < qpiwsStrings.size() - 1) { + qpiwsStr += "; "; + } + } + liveData["Fault_or_Warning"] = qpiwsStr; + } + else + { + liveData["Fault_or_Warning"] = "None"; + } + } + return true; + } + else if (protocol == NoD) + { + return false; + } + else + { + return false; + } +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 5bdd69e..15d9e19 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -578,6 +578,7 @@ bool sendtoMQTT() mqttclient.publish(topicBuilder(buff, "RAW/QMOD"), (mppClient.get.raw.qmod).c_str()); mqttclient.publish(topicBuilder(buff, "RAW/QALL"), (mppClient.get.raw.qall).c_str()); mqttclient.publish(topicBuilder(buff, "RAW/QMN"), (mppClient.get.raw.qmn).c_str()); + mqttclient.publish(topicBuilder(buff, "RAW/QPIWS"), (mppClient.get.raw.qpiws).c_str()); } else {