Browse Source

0.7.35

* fixed timestamp for alarms send over MqTT
* auto-patch of `AsyncWebServer` #834, #1036
* Update documentation in Git regarding `ESP8266` default NRF24 pin assignments
pull/1121/head
lumapu 1 year ago
parent
commit
ed268d1b63
  1. 10
      Getting_Started.md
  2. 6
      README.md
  3. 13
      patches/AsyncWeb_Prometheus.patch
  4. 20
      scripts/applyPatches.py
  5. 5
      src/CHANGES.md
  6. 3
      src/platformio.ini
  7. 6
      src/publisher/pubMqtt.h

10
Getting_Started.md

@ -1,4 +1,4 @@
## Overview
## Overview
On this page, you'll find detailed instructions on how to wire the module of a Wemos D1 mini or ESP32 to the radio module, as well as how to flash it with the latest firmware. This information will enable you to communicate with compatible inverters.
@ -122,11 +122,11 @@ This is an example wiring using a Wemos D1 mini.<br>
##### Schematic
![Schematic](doc/AhoyWemos_Schaltplan.jpg)
![Schematic](https://ahoydtu.de/img/fritzing/esp8266_nrf_sch.png)
##### Symbolic view
![Symbolic](doc/AhoyWemos_Steckplatine.jpg)
![Symbolic](https://ahoydtu.de/img/fritzing/esp8266_nrf.png)
#### ESP8266 wiring example on 30pin Lolin NodeMCU v3
@ -146,11 +146,11 @@ Example wiring for a 38pin ESP32 module
##### Schematic
![Schematic](doc/Wiring_ESP32_Schematic.png)
![Schematic](https://ahoydtu.de/img/fritzing/esp32-38_nrf_sch.png)
##### Symbolic view
![Symbolic](doc/Wiring_ESP32_Symbol.png)
![Symbolic](https://ahoydtu.de/img/fritzing/esp32-38_nrf.png)
##### ESP32 GPIO settings

6
README.md

@ -1,4 +1,5 @@
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa] [![Ahoy Dev Build][dev-action-badge]][dev-action-link]
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]
[![Ahoy Build][release-action-badge]][release-action-link] [![Ahoy Dev Build][dev-action-badge]][dev-action-link]
This work is licensed under a
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].
@ -9,6 +10,9 @@ This work is licensed under a
[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png
[cc-by-nc-sa-shield]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg
[release-action-badge]: https://github.com/lumapu/ahoy/actions/workflows/compile_release.yml/badge.svg
[release-action-link]: https://github.com/lumapu/ahoy/actions/workflows/compile_release.yml
[dev-action-badge]: https://github.com/lumapu/ahoy/actions/workflows/compile_development.yml/badge.svg
[dev-action-link]: https://github.com/lumapu/ahoy/actions/workflows/compile_development.yml

13
patches/AsyncWeb_Prometheus.patch

@ -0,0 +1,13 @@
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
index 22a549f..e0b36b3 100644
--- a/src/WebResponses.cpp
+++ b/src/WebResponses.cpp
@@ -318,7 +318,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
free(buf);
return 0;
}
- outLen = sprintf_P((char*)buf+headLen, PSTR("%x"), readLen) + headLen;
+ outLen = sprintf_P((char*)buf+headLen, PSTR("%04x"), readLen) + headLen;
while(outLen < headLen + 4) buf[outLen++] = ' ';
buf[outLen++] = '\r';
buf[outLen++] = '\n';

20
scripts/applyPatches.py

@ -0,0 +1,20 @@
import os
import subprocess
Import("env")
def applyPatch(libName, patchFile):
os.chdir('.pio/libdeps/' + env['PIOENV'] + '/' + libName)
process = subprocess.run(['git', 'apply', '--reverse', '--check', '../../../../' + patchFile], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if (process.returncode == 0):
print('\'' + patchFile + '\' already applied')
else:
process = subprocess.run(['git', 'apply', '../../../../' + patchFile])
if (process.returncode == 0):
print('\'' + patchFile + '\' applied')
else:
print('applying \'' + patchFile + '\' failed')
# list of patches to apply (relative to /src)
applyPatch("ESP Async WebServer", "../patches/AsyncWeb_Prometheus.patch")

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes
## 0.7.35 - 2023-08-17
* fixed timestamp for alarms send over MqTT
* auto-patch of `AsyncWebServer` #834, #1036
* Update documentation in Git regarding `ESP8266` default NRF24 pin assignments
## 0.7.34 - 2023-08-16
* fixed timezone offset of alarms
* added `AC` and `DC` to `/live` #1098

3
src/platformio.ini

@ -21,6 +21,7 @@ monitor_speed = 115200
extra_scripts =
pre:../scripts/auto_firmware_version.py
pre:web/html/convert.py
pre:../scripts/applyPatches.py
lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer
@ -183,4 +184,4 @@ build_flags =
-std=gnu++17
build_unflags = -std=gnu++11
monitor_filters =
time ; Add timestamp with milliseconds for each new line
time ; Add timestamp with milliseconds for each new line

6
src/publisher/pubMqtt.h

@ -500,6 +500,8 @@ class PubMqtt {
void sendAlarmData() {
Inverter<> *iv;
uint32_t localTime = gTimezone.toLocal(*mUtcTimestamp);
uint32_t lastMidnight = gTimezone.toUTC(localTime - (localTime % 86400)); // last midnight local time
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
if(!mSendAlarm[i])
continue;
@ -527,11 +529,11 @@ class PubMqtt {
publish(mSubTopic, mVal, true);
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/alarm/%d/start", iv->config->name, j);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].start);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].start + lastMidnight);
publish(mSubTopic, mVal, true);
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/alarm/%d/end", iv->config->name, j);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].end);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].end + lastMidnight);
publish(mSubTopic, mVal, true);
yield();
}

Loading…
Cancel
Save