Browse Source

Merge branch 'development03' into eth

pull/1093/head
lumapu 2 years ago
parent
commit
6767792601
  1. 2
      User_Manual.md
  2. 10
      src/CHANGES.md
  3. 3
      src/app.h
  4. 2
      src/defines.h
  5. 2
      src/hm/hmPayload.h
  6. 74
      src/platformio.ini
  7. 22
      src/publisher/pubMqtt.h
  8. 3
      src/web/html/api.js
  9. 12
      src/web/html/visualization.html

2
User_Manual.md

@ -65,7 +65,7 @@ The AhoyDTU will publish on the following topics
|Q_AC | 21.200| actual AC reactive power in var|
|F_AC | 49.990| actual AC Frequency in Hz|
|PF_AC | 95.800| actual AC Power factor|
|Temp | 19.800|Temperature of inverter in Celsius|
|Temp | 19.800|Temperature of inverter in degree Celsius|
|EVT | 9.000|Last Event/Alarm Message Index|
|YieldDay | 51.000|Energy converted to AC per day in Watt hours (measured on DC)|
|YieldTotal | 465.294|Energy converted to AC since reset Watt hours (measured on DC)|

10
src/CHANGES.md

@ -1,5 +1,15 @@
# Development Changes
## 0.7.23 - 2023-08-04
* merge PR #1056, visualization html
* update MqTT library to 1.4.4
* update RF24 library to 1.4.7
* update ArduinoJson library to 6.21.3
* set minimum invervall for `/live` to 5 seconds
## 0.7.22 - 2023-08-04
* attempt to fix homeassistant auto discovery #1066
## 0.7.21 - 2023-07-30
* fix MqTT YieldDay Total goes to 0 serveral times #1016

3
src/app.h

@ -8,7 +8,6 @@
#include <Arduino.h>
#include <ArduinoJson.h>
#include <RF24.h>
#include "appInterface.h"
#include "config/settings.h"
@ -34,6 +33,8 @@
#include "wifi/ahoywifi.h"
#endif /* defined(ETHERNET) */
#include <RF24.h> // position is relevant since version 1.4.7 of this library
// convert degrees and radians for sun calculation
#define SIN(x) (sin(radians(x)))
#define COS(x) (cos(radians(x)))

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 21
#define VERSION_PATCH 23
//-------------------------------------
typedef struct {

2
src/hm/hmPayload.h

@ -92,7 +92,7 @@ class HmPayload {
yield();
}
iv->doCalculations();
notify(0x0b);
notify(0x0b, iv);
}*/
void ivSendHighPrio(Inverter<> *iv) {

74
src/platformio.ini

@ -24,10 +24,10 @@ extra_scripts =
lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer
nrf24/RF24 @ 1.4.5
nrf24/RF24 @ 1.4.7
paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.4.2
bblanchon/ArduinoJson @ ^6.21.2
https://github.com/bertmelis/espMqttClient#v1.4.4
bblanchon/ArduinoJson @ ^6.21.3
https://github.com/JChristensen/Timezone @ ^1.2.4
olikraus/U8g2 @ ^2.34.17
zinggjm/GxEPD2 @ ^1.5.2
@ -37,12 +37,12 @@ lib_deps =
platform = espressif8266
board = esp12e
board_build.f_cpu = 80000000L
build_flags = -D RELEASE -std=gnu++17
build_flags =
-D RELEASE
-std=gnu++17
-DEMC_MIN_FREE_MEMORY=4096
;-Wl,-Map,output.map
monitor_filters =
;default ; Remove typical terminal control codes from input
;time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
esp8266_exception_decoder
@ -50,21 +50,31 @@ monitor_filters =
platform = espressif8266
board = esp12e
board_build.f_cpu = 80000000L
build_flags = -D RELEASE -std=gnu++17 -DENABLE_PROMETHEUS_EP
build_flags =
-D RELEASE
-std=gnu++17
-DENABLE_PROMETHEUS_EP
-DEMC_MIN_FREE_MEMORY=4096
monitor_filters =
;default ; Remove typical terminal control codes from input
;time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
esp8266_exception_decoder
[env:esp8266-debug]
platform = espressif8266
board = esp12e
board_build.f_cpu = 80000000L
build_flags = -DDEBUG_LEVEL=DBG_DEBUG -std=gnu++17 -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
build_flags =
-DDEBUG_LEVEL=DBG_DEBUG
-std=gnu++17
-DEMC_MIN_FREE_MEMORY=4096
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
-DDEBUG_ESP_OOM
-DDEBUG_ESP_PORT=Serial
-DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
build_type = debug
monitor_filters =
;default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
@ -73,18 +83,21 @@ platform = espressif8266
board = esp8285
board_build.ldscript = eagle.flash.1m64.ld
board_build.f_cpu = 80000000L
build_flags = -D RELEASE -std=gnu++17
build_flags =
-D RELEASE
-std=gnu++17
-DEMC_MIN_FREE_MEMORY=4096
monitor_filters =
;default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
[env:esp8285-debug]
platform = espressif8266
board = esp8285
board_build.ldscript = eagle.flash.1m64.ld
board_build.f_cpu = 80000000L
build_flags = -DDEBUG_LEVEL=DBG_DEBUG
build_flags =
-DDEBUG_LEVEL=DBG_DEBUG
-DEMC_MIN_FREE_MEMORY=4096
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_CLIENT
@ -93,38 +106,35 @@ build_flags = -DDEBUG_LEVEL=DBG_DEBUG
-DDEBUG_ESP_PORT=Serial
build_type = debug
monitor_filters =
;default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
[env:esp32-wroom32-release]
platform = espressif32@6.1.0
board = lolin_d32
build_flags = -D RELEASE -std=gnu++17
build_flags =
-D RELEASE
-std=gnu++17
build_unflags = -std=gnu++11
monitor_filters =
;default ; Remove typical terminal control codes from input
;time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
esp32_exception_decoder
[env:esp32-wroom32-release-prometheus]
platform = espressif32@6.1.0
board = lolin_d32
build_flags = -D RELEASE
build_flags =
-D RELEASE
-std=gnu++17
-DENABLE_PROMETHEUS_EP
build_unflags = -std=gnu++11
monitor_filters =
;default ; Remove typical terminal control codes from input
;time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
esp32_exception_decoder
[env:esp32-wroom32-debug]
platform = espressif32@6.1.0
board = lolin_d32
build_flags = -DDEBUG_LEVEL=DBG_DEBUG
build_flags =
-DDEBUG_LEVEL=DBG_DEBUG
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_CLIENT
@ -135,7 +145,6 @@ build_flags = -DDEBUG_LEVEL=DBG_DEBUG
build_unflags = -std=gnu++11
build_type = debug
monitor_filters =
;default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
@ -169,12 +178,11 @@ monitor_filters =
platform = espressif32@6.1.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
upload_speed = 115200
debug_tool = esp-builtin
debug_speed = 12000
build_flags = -D RELEASE -std=gnu++17
build_flags =
-D RELEASE
-std=gnu++17
build_unflags = -std=gnu++11
monitor_filters =
;default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory
time ; Add timestamp with milliseconds for each new line

22
src/publisher/pubMqtt.h

@ -184,23 +184,13 @@ class PubMqtt {
if(!mClient.connected())
return;
if(addTopic){
if(addTopic)
snprintf(mTopic, MQTT_TOPIC_LEN + 32 + MAX_NAME_LENGTH + 1, "%s/%s", mCfgMqtt->topic, subTopic);
} else {
else
snprintf(mTopic, MQTT_TOPIC_LEN + 32 + MAX_NAME_LENGTH + 1, "%s", subTopic);
}
do {
if(0 != mClient.publish(mTopic, QOS_0, retained, payload))
break;
if(!mClient.connected())
break;
#if defined(ESP8266)
mClient.loop();
#endif
yield();
} while(1);
mClient.publish(mTopic, QOS_0, retained, payload);
yield();
mTxCnt++;
}
@ -391,9 +381,9 @@ class PubMqtt {
const char *devCls, *stateCls;
if (!total) {
if (rec->assign[mDiscovery.sub].ch == CH0)
snprintf(name, 32, "%s %s", iv->config->name, iv->getFieldName(mDiscovery.sub, rec));
snprintf(name, 32, "%s", iv->getFieldName(mDiscovery.sub, rec));
else
snprintf(name, 32, "%s CH%d %s", iv->config->name, rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(name, 32, "CH%d_%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(topic, 64, "/ch%d/%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(uniq_id, 32, "ch%d_%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));

3
src/web/html/api.js

@ -52,8 +52,7 @@ function ml(tagName, ...args) {
function nester(el, n) {
if (typeof n === "string") {
var t = document.createTextNode(n);
el.appendChild(t);
el.innerHTML = n;
} else if (n instanceof Array) {
for(var i = 0; i < n.length; i++) {
if (typeof n[i] === "string") {

12
src/web/html/visualization.html

@ -92,14 +92,14 @@
total[2] += obj.ch[0][6]; // YieldTotal
total[3] += obj.ch[0][8]; // P_DC
total[4] += obj.ch[0][10]; // Q_AC
var t = span(" &deg; C");
var t = span("&nbsp;&deg;C");
return ml("div", {class: "row mt-2"},
ml("div", {class: "col"}, [
ml("div", {class: "p-2 iv-h"},
ml("div", {class: "row"}, [
ml("div", {class: "col mx-2 mx-md-1"}, obj.name),
ml("div", {class: "col a-c"}, "Power limit " + ((obj.power_limit_read == 65535) ? "n/a" : (obj.power_limit_read + " %"))),
ml("div", {class: "col a-r mx-2 mx-md-1"}, String(obj.ch[0][5]) + t.innerHTML)
ml("div", {class: "col a-c"}, "Power limit " + ((obj.power_limit_read == 65535) ? "n/a" : (obj.power_limit_read + "&nbsp;%"))),
ml("div", {class: "col a-r mx-2 mx-md-1"}, String(obj.ch[0][5]) + t.innerText)
])
),
ml("div", {class: "p-2 iv-bg"}, [
@ -221,9 +221,11 @@
break;
}
}
document.getElementById("refresh").innerHTML = obj["refresh"];
if(obj.refresh < 5)
obj.refresh = 5;
document.getElementById("refresh").innerHTML = obj.refresh;
if(true == exeOnce) {
window.setInterval("getAjax('/api/live', parse)", obj["refresh"] * 1000);
window.setInterval("getAjax('/api/live', parse)", obj.refresh * 1000);
exeOnce = false;
}
}

Loading…
Cancel
Save