This commit is contained in:
Ralf Bauer 2023-06-09 12:02:59 +02:00
commit 60a335097b
26 changed files with 238 additions and 247 deletions

View File

@ -37,7 +37,7 @@ jobs:
- name: Get default environments - name: Get default environments
id: envs id: envs
run: | run: |
echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT echo "environments=$(pio project config --json-output | jq -cr '.[1][1][0][1]|split(",")')" >> $GITHUB_OUTPUT
outputs: outputs:
environments: ${{ steps.envs.outputs.environments }} environments: ${{ steps.envs.outputs.environments }}
@ -98,17 +98,15 @@ jobs:
- name: Rename Firmware - name: Rename Firmware
run: mv .pio/build/${{ matrix.environment }}/firmware.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin run: mv .pio/build/${{ matrix.environment }}/firmware.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin
- name: Copy boot_app0.bin - name: Rename Factory Firmware
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pio/build/${{ matrix.environment }}/boot_app0.bin run: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.factory.bin
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: opendtu-${{ matrix.environment }} name: opendtu-${{ matrix.environment }}
path: | path: |
.pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin
.pio/build/${{ matrix.environment }}/partitions.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.factory.bin
.pio/build/${{ matrix.environment }}/bootloader.bin
.pio/build/${{ matrix.environment }}/boot_app0.bin
release: release:
name: Create Release name: Create Release
@ -121,7 +119,7 @@ jobs:
- name: Build Changelog - name: Build Changelog
id: github_release id: github_release
uses: mikepenz/release-changelog-builder-action@v3.7.0 uses: mikepenz/release-changelog-builder-action@v3
with: with:
failOnError: true failOnError: true
commitMode: true commitMode: true
@ -133,12 +131,10 @@ jobs:
with: with:
path: artifacts/ path: artifacts/
- name: Create ZIPs - name: Move all files to the same location
run: | run: |
ls -R ls -R
sudo apt install zip
cd artifacts cd artifacts
for i in */; do zip -r "${i%/}.zip" "$i"; done
for i in */; do cp ${i}opendtu-*.bin ./; done for i in */; do cp ${i}opendtu-*.bin ./; done
- name: Create release - name: Create release

View File

@ -210,14 +210,7 @@ It is recommended to make all changes only in the 'platformio_override.ini', th
### using the pre-compiled .bin files ### using the pre-compiled .bin files
The pre-compiled binary files can be found here on the [github page behind "Releases"](https://github.com/tbnobody/OpenDTU/releases) (look at the right column). For a first installation on an ESP32, download `opendtu-generic.zip`, unpack and use a ESP32 flash tool of your choice (see next chapter) to flash the `.bin` files to the right addresses: The pre-compiled binary files can be found here on the [github page behind "Releases"](https://github.com/tbnobody/OpenDTU/releases) (look at the right column). For a first installation on an ESP32, download `opendtu-generic.factory.bin` and use a ESP32 flash tool of your choice to flash the `.bin` file to the address `0x0`. (The previous method with different .bin files is no more necessary.)
| Address | File |
| ---------| ---------------------- |
| 0x1000 | bootloader.bin |
| 0x8000 | partitions.bin |
| 0xe000 | boot_app0.bin |
| 0x10000 | opendtu-*.bin |
For further updates download `opendtu-generic.bin` and use the over-the-air firmware update in OpenDTU's web interface. For further updates download `opendtu-generic.bin` and use the over-the-air firmware update in OpenDTU's web interface.
@ -226,10 +219,7 @@ For further updates download `opendtu-generic.bin` and use the over-the-air firm
```bash ```bash
esptool.py --port /dev/ttyUSB0 --chip esp32 --before default_reset --after hard_reset \ esptool.py --port /dev/ttyUSB0 --chip esp32 --before default_reset --after hard_reset \
write_flash --flash_mode dout --flash_freq 40m --flash_size detect \ write_flash --flash_mode dout --flash_freq 40m --flash_size detect \
0x1000 bootloader.bin \ 0x0 opendtu-generic.factory.bin
0x8000 partitions.bin \
0xe000 boot_app0.bin \
0x10000 opendtu-generic.bin
``` ```
#### Flash with Espressif Flash Download Tool (Windows) #### Flash with Espressif Flash Download Tool (Windows)

View File

@ -1,6 +1,6 @@
[ [
{ {
"name": "Generic NodeMCU 32", "name": "NRF24",
"nrf24": { "nrf24": {
"miso": 19, "miso": 19,
"mosi": 23, "mosi": 23,
@ -10,17 +10,11 @@
"cs": 5 "cs": 5
}, },
"eth": { "eth": {
"enabled": false, "enabled": false
"phy_addr": -1,
"power": -1,
"mdc": -1,
"mdio": -1,
"type": 0,
"clk_mode": 0
} }
}, },
{ {
"name": "Generic NodeMCU 32 with CMT2300A", "name": "CMT2300A",
"nrf24": { "nrf24": {
"miso": -1, "miso": -1,
"mosi": -1, "mosi": -1,
@ -38,17 +32,11 @@
"gpio3": 16 "gpio3": 16
}, },
"eth": { "eth": {
"enabled": false, "enabled": false
"phy_addr": -1,
"power": -1,
"mdc": -1,
"mdio": -1,
"type": 0,
"clk_mode": 0
} }
}, },
{ {
"name": "Generic NodeMCU 32 with SSD1306", "name": "NRF24 with SSD1306",
"nrf24": { "nrf24": {
"miso": 19, "miso": 19,
"mosi": 23, "mosi": 23,
@ -58,13 +46,7 @@
"cs": 5 "cs": 5
}, },
"eth": { "eth": {
"enabled": false, "enabled": false
"phy_addr": -1,
"power": -1,
"mdc": -1,
"mdio": -1,
"type": 0,
"clk_mode": 0
}, },
"display": { "display": {
"type": 2, "type": 2,
@ -73,7 +55,7 @@
} }
}, },
{ {
"name": "Generic NodeMCU 32 with SH1106", "name": "NRF24 with SH1106",
"nrf24": { "nrf24": {
"miso": 19, "miso": 19,
"mosi": 23, "mosi": 23,
@ -83,13 +65,7 @@
"cs": 5 "cs": 5
}, },
"eth": { "eth": {
"enabled": false, "enabled": false
"phy_addr": -1,
"power": -1,
"mdc": -1,
"mdio": -1,
"type": 0,
"clk_mode": 0
}, },
"display": { "display": {
"type": 3, "type": 3,
@ -98,7 +74,61 @@
} }
}, },
{ {
"name": "Generic NodeMCU 32 with NRF + CMT Module", "name": "CMT2300A with SSD1306",
"nrf24": {
"miso": -1,
"mosi": -1,
"clk": -1,
"irq": -1,
"en": -1,
"cs": -1
},
"cmt": {
"clk": 18,
"cs": 4,
"fcs": 5,
"sdio": 23,
"gpio2": 19,
"gpio3": 16
},
"eth": {
"enabled": false
},
"display": {
"type": 2,
"data": 21,
"clk": 22
}
},
{
"name": "CMT2300A with SH1106",
"nrf24": {
"miso": -1,
"mosi": -1,
"clk": -1,
"irq": -1,
"en": -1,
"cs": -1
},
"cmt": {
"clk": 18,
"cs": 4,
"fcs": 5,
"sdio": 23,
"gpio2": 19,
"gpio3": 16
},
"eth": {
"enabled": false
},
"display": {
"type": 3,
"data": 21,
"clk": 22
}
},
{
"name": "NRF24 + CMT2300A",
"nrf24": { "nrf24": {
"miso": 19, "miso": 19,
"mosi": 23, "mosi": 23,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

@ -51,6 +51,69 @@ void HoymilesRadio::sendLastPacketAgain()
sendEsbPacket(cmd); sendEsbPacket(cmd);
} }
void HoymilesRadio::handleReceivedPackage()
{
if (_busyFlag && _rxTimeout.occured()) {
Hoymiles.getMessageOutput()->println("RX Period End");
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterBySerial(_commandQueue.front().get()->getTargetAddress());
if (nullptr != inv) {
CommandAbstract* cmd = _commandQueue.front().get();
uint8_t verifyResult = inv->verifyAllFragments(cmd);
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
sendLastPacketAgain();
} else if (verifyResult == FRAGMENT_ALL_MISSING_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Nothing received, resend count exeeded");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_RETRANSMIT_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Retransmit timeout");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_HANDLE_ERROR) {
Hoymiles.getMessageOutput()->println("Packet handling error");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult > 0) {
// Perform Retransmit
Hoymiles.getMessageOutput()->print("Request retransmit: ");
Hoymiles.getMessageOutput()->println(verifyResult);
sendRetransmitPacket(verifyResult);
} else {
// Successful received all packages
Hoymiles.getMessageOutput()->println("Success");
_commandQueue.pop();
_busyFlag = false;
}
} else {
// If inverter was not found, assume the command is invalid
Hoymiles.getMessageOutput()->println("RX: Invalid inverter found");
_commandQueue.pop();
_busyFlag = false;
}
} else if (!_busyFlag) {
// Currently in idle mode --> send packet if one is in the queue
if (!_commandQueue.empty()) {
CommandAbstract* cmd = _commandQueue.front().get();
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
if (nullptr != inv) {
inv->clearRxFragmentBuffer();
sendEsbPacket(cmd);
} else {
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
_commandQueue.pop();
}
}
}
}
void HoymilesRadio::dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline) void HoymilesRadio::dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline)
{ {
for (uint8_t i = 0; i < len; i++) { for (uint8_t i = 0; i < len; i++) {

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include "TimeoutHelper.h"
#include "commands/CommandAbstract.h" #include "commands/CommandAbstract.h"
#include "types.h" #include "types.h"
#include <memory> #include <memory>
@ -30,9 +31,12 @@ protected:
virtual void sendEsbPacket(CommandAbstract* cmd) = 0; virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
void sendRetransmitPacket(uint8_t fragment_id); void sendRetransmitPacket(uint8_t fragment_id);
void sendLastPacketAgain(); void sendLastPacketAgain();
void handleReceivedPackage();
serial_u _dtuSerial; serial_u _dtuSerial;
std::queue<std::shared_ptr<CommandAbstract>> _commandQueue; std::queue<std::shared_ptr<CommandAbstract>> _commandQueue;
bool _isInitialized = false; bool _isInitialized = false;
bool _busyFlag = false; bool _busyFlag = false;
TimeoutHelper _rxTimeout;
}; };

View File

@ -151,65 +151,7 @@ void HoymilesRadio_CMT::loop()
} }
} }
if (_busyFlag && _rxTimeout.occured()) { handleReceivedPackage();
Hoymiles.getMessageOutput()->println("RX Period End");
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterBySerial(_commandQueue.front().get()->getTargetAddress());
if (nullptr != inv) {
CommandAbstract* cmd = _commandQueue.front().get();
uint8_t verifyResult = inv->verifyAllFragments(cmd);
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
sendLastPacketAgain();
} else if (verifyResult == FRAGMENT_ALL_MISSING_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Nothing received, resend count exeeded");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_RETRANSMIT_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Retransmit timeout");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_HANDLE_ERROR) {
Hoymiles.getMessageOutput()->println("Packet handling error");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult > 0) {
// Perform Retransmit
Hoymiles.getMessageOutput()->print("Request retransmit: ");
Hoymiles.getMessageOutput()->println(verifyResult);
sendRetransmitPacket(verifyResult);
} else {
// Successful received all packages
Hoymiles.getMessageOutput()->println("Success");
_commandQueue.pop();
_busyFlag = false;
}
} else {
// If inverter was not found, assume the command is invalid
Hoymiles.getMessageOutput()->println("RX: Invalid inverter found");
_commandQueue.pop();
_busyFlag = false;
}
} else if (!_busyFlag) {
// Currently in idle mode --> send packet if one is in the queue
if (!_commandQueue.empty()) {
CommandAbstract* cmd = _commandQueue.front().get();
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
if (nullptr != inv) {
inv->clearRxFragmentBuffer();
sendEsbPacket(cmd);
} else {
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
_commandQueue.pop();
}
}
}
} }
void HoymilesRadio_CMT::setPALevel(int8_t paLevel) void HoymilesRadio_CMT::setPALevel(int8_t paLevel)

View File

@ -2,7 +2,6 @@
#pragma once #pragma once
#include "HoymilesRadio.h" #include "HoymilesRadio.h"
#include "TimeoutHelper.h"
#include "commands/CommandAbstract.h" #include "commands/CommandAbstract.h"
#include "types.h" #include "types.h"
#include <Arduino.h> #include <Arduino.h>
@ -48,7 +47,6 @@ private:
bool _gpio3_configured = false; bool _gpio3_configured = false;
std::queue<fragment_t> _rxBuffer; std::queue<fragment_t> _rxBuffer;
TimeoutHelper _rxTimeout;
TimeoutHelper _txTimeout; TimeoutHelper _txTimeout;
uint32_t _inverterTargetFrequency = HOYMILES_CMT_WORK_FREQ; uint32_t _inverterTargetFrequency = HOYMILES_CMT_WORK_FREQ;

View File

@ -55,6 +55,7 @@ void HoymilesRadio_NRF::loop()
memset(f.fragment, 0xcc, MAX_RF_PAYLOAD_SIZE); memset(f.fragment, 0xcc, MAX_RF_PAYLOAD_SIZE);
f.len = _radio->getDynamicPayloadSize(); f.len = _radio->getDynamicPayloadSize();
f.channel = _radio->getChannel(); f.channel = _radio->getChannel();
f.rssi = _radio->testRPD() ? -30 : -80;
if (f.len > MAX_RF_PAYLOAD_SIZE) if (f.len > MAX_RF_PAYLOAD_SIZE)
f.len = MAX_RF_PAYLOAD_SIZE; f.len = MAX_RF_PAYLOAD_SIZE;
_radio->read(f.fragment, f.len); _radio->read(f.fragment, f.len);
@ -76,7 +77,9 @@ void HoymilesRadio_NRF::loop()
if (nullptr != inv) { if (nullptr != inv) {
// Save packet in inverter rx buffer // Save packet in inverter rx buffer
Hoymiles.getMessageOutput()->printf("RX Channel: %d --> ", f.channel); Hoymiles.getMessageOutput()->printf("RX Channel: %d --> ", f.channel);
dumpBuf(f.fragment, f.len); dumpBuf(f.fragment, f.len, false);
Hoymiles.getMessageOutput()->printf("| %d dBm\r\n", f.rssi);
inv->addRxFragment(f.fragment, f.len); inv->addRxFragment(f.fragment, f.len);
} else { } else {
Hoymiles.getMessageOutput()->println("Inverter Not found!"); Hoymiles.getMessageOutput()->println("Inverter Not found!");
@ -91,65 +94,7 @@ void HoymilesRadio_NRF::loop()
} }
} }
if (_busyFlag && _rxTimeout.occured()) { handleReceivedPackage();
Hoymiles.getMessageOutput()->println("RX Period End");
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterBySerial(_commandQueue.front().get()->getTargetAddress());
if (nullptr != inv) {
CommandAbstract* cmd = _commandQueue.front().get();
uint8_t verifyResult = inv->verifyAllFragments(cmd);
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
sendLastPacketAgain();
} else if (verifyResult == FRAGMENT_ALL_MISSING_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Nothing received, resend count exeeded");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_RETRANSMIT_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Retransmit timeout");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult == FRAGMENT_HANDLE_ERROR) {
Hoymiles.getMessageOutput()->println("Packet handling error");
_commandQueue.pop();
_busyFlag = false;
} else if (verifyResult > 0) {
// Perform Retransmit
Hoymiles.getMessageOutput()->print("Request retransmit: ");
Hoymiles.getMessageOutput()->println(verifyResult);
sendRetransmitPacket(verifyResult);
} else {
// Successful received all packages
Hoymiles.getMessageOutput()->println("Success");
_commandQueue.pop();
_busyFlag = false;
}
} else {
// If inverter was not found, assume the command is invalid
Hoymiles.getMessageOutput()->println("RX: Invalid inverter found");
_commandQueue.pop();
_busyFlag = false;
}
} else if (!_busyFlag) {
// Currently in idle mode --> send packet if one is in the queue
if (!_commandQueue.empty()) {
CommandAbstract* cmd = _commandQueue.front().get();
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
if (nullptr != inv) {
inv->clearRxFragmentBuffer();
sendEsbPacket(cmd);
} else {
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
_commandQueue.pop();
}
}
}
} }
void HoymilesRadio_NRF::setPALevel(rf24_pa_dbm_e paLevel) void HoymilesRadio_NRF::setPALevel(rf24_pa_dbm_e paLevel)

View File

@ -2,7 +2,6 @@
#pragma once #pragma once
#include "HoymilesRadio.h" #include "HoymilesRadio.h"
#include "TimeoutHelper.h"
#include "commands/CommandAbstract.h" #include "commands/CommandAbstract.h"
#include <RF24.h> #include <RF24.h>
#include <memory> #include <memory>
@ -44,5 +43,4 @@ private:
volatile bool _packetReceived = false; volatile bool _packetReceived = false;
std::queue<fragment_t> _rxBuffer; std::queue<fragment_t> _rxBuffer;
TimeoutHelper _rxTimeout;
}; };

View File

@ -5,47 +5,47 @@
#include "HMT_6CH.h" #include "HMT_6CH.h"
static const byteAssign_t byteAssignment[] = { static const byteAssign_t byteAssignment[] = {
{ TYPE_DC, CH0, FLD_UDC, UNIT_V, 2, 2, 10, false, 1 }, { TYPE_DC, CH0, FLD_UDC, UNIT_V, 46, 2, 10, false, 1 },
{ TYPE_DC, CH0, FLD_IDC, UNIT_A, 4, 2, 100, false, 2 }, { TYPE_DC, CH0, FLD_IDC, UNIT_A, 50, 2, 100, false, 2 },
{ TYPE_DC, CH0, FLD_PDC, UNIT_W, 8, 2, 10, false, 1 }, { TYPE_DC, CH0, FLD_PDC, UNIT_W, 54, 2, 10, false, 1 },
{ TYPE_DC, CH0, FLD_YT, UNIT_KWH, 12, 4, 1000, false, 3 }, { TYPE_DC, CH0, FLD_YT, UNIT_KWH, 60, 4, 1000, false, 3 },
{ TYPE_DC, CH0, FLD_YD, UNIT_WH, 20, 2, 1, false, 0 }, { TYPE_DC, CH0, FLD_YD, UNIT_WH, 66, 2, 1, false, 0 },
{ TYPE_DC, CH0, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH0, CMD_CALC, false, 3 }, { TYPE_DC, CH0, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH5, CMD_CALC, false, 3 },
{ TYPE_DC, CH1, FLD_UDC, UNIT_V, 2, 2, 10, false, 1 }, { TYPE_DC, CH1, FLD_UDC, UNIT_V, 46, 2, 10, false, 1 },
{ TYPE_DC, CH1, FLD_IDC, UNIT_A, 6, 2, 100, false, 2 }, { TYPE_DC, CH1, FLD_IDC, UNIT_A, 48, 2, 100, false, 2 },
{ TYPE_DC, CH1, FLD_PDC, UNIT_W, 10, 2, 10, false, 1 }, { TYPE_DC, CH1, FLD_PDC, UNIT_W, 52, 2, 10, false, 1 },
{ TYPE_DC, CH1, FLD_YT, UNIT_KWH, 16, 4, 1000, false, 3 }, { TYPE_DC, CH1, FLD_YT, UNIT_KWH, 56, 4, 1000, false, 3 },
{ TYPE_DC, CH1, FLD_YD, UNIT_WH, 22, 2, 1, false, 0 }, { TYPE_DC, CH1, FLD_YD, UNIT_WH, 64, 2, 1, false, 0 },
{ TYPE_DC, CH1, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH1, CMD_CALC, false, 3 }, { TYPE_DC, CH1, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH4, CMD_CALC, false, 3 },
{ TYPE_DC, CH2, FLD_UDC, UNIT_V, 24, 2, 10, false, 1 }, { TYPE_DC, CH2, FLD_UDC, UNIT_V, 24, 2, 10, false, 1 },
{ TYPE_DC, CH2, FLD_IDC, UNIT_A, 26, 2, 100, false, 2 }, { TYPE_DC, CH2, FLD_IDC, UNIT_A, 28, 2, 100, false, 2 },
{ TYPE_DC, CH2, FLD_PDC, UNIT_W, 30, 2, 10, false, 1 }, { TYPE_DC, CH2, FLD_PDC, UNIT_W, 32, 2, 10, false, 1 },
{ TYPE_DC, CH2, FLD_YT, UNIT_KWH, 34, 4, 1000, false, 3 }, { TYPE_DC, CH2, FLD_YT, UNIT_KWH, 38, 4, 1000, false, 3 },
{ TYPE_DC, CH2, FLD_YD, UNIT_WH, 42, 2, 1, false, 0 }, { TYPE_DC, CH2, FLD_YD, UNIT_WH, 44, 2, 1, false, 0 },
{ TYPE_DC, CH2, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH2, CMD_CALC, false, 3 }, { TYPE_DC, CH2, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH3, CMD_CALC, false, 3 },
{ TYPE_DC, CH3, FLD_UDC, UNIT_V, 24, 2, 10, false, 1 }, { TYPE_DC, CH3, FLD_UDC, UNIT_V, 24, 2, 10, false, 1 },
{ TYPE_DC, CH3, FLD_IDC, UNIT_A, 28, 2, 100, false, 2 }, { TYPE_DC, CH3, FLD_IDC, UNIT_A, 26, 2, 100, false, 2 },
{ TYPE_DC, CH3, FLD_PDC, UNIT_W, 32, 2, 10, false, 1 }, { TYPE_DC, CH3, FLD_PDC, UNIT_W, 30, 2, 10, false, 1 },
{ TYPE_DC, CH3, FLD_YT, UNIT_KWH, 38, 4, 1000, false, 3 }, { TYPE_DC, CH3, FLD_YT, UNIT_KWH, 34, 4, 1000, false, 3 },
{ TYPE_DC, CH3, FLD_YD, UNIT_WH, 44, 2, 1, false, 0 }, { TYPE_DC, CH3, FLD_YD, UNIT_WH, 42, 2, 1, false, 0 },
{ TYPE_DC, CH3, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH3, CMD_CALC, false, 3 }, { TYPE_DC, CH3, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH2, CMD_CALC, false, 3 },
{ TYPE_DC, CH4, FLD_UDC, UNIT_V, 46, 2, 10, false, 1 }, { TYPE_DC, CH4, FLD_UDC, UNIT_V, 2, 2, 10, false, 1 },
{ TYPE_DC, CH4, FLD_IDC, UNIT_A, 48, 2, 100, false, 2 }, { TYPE_DC, CH4, FLD_IDC, UNIT_A, 6, 2, 100, false, 2 },
{ TYPE_DC, CH4, FLD_PDC, UNIT_W, 52, 2, 10, false, 1 }, { TYPE_DC, CH4, FLD_PDC, UNIT_W, 10, 2, 10, false, 1 },
{ TYPE_DC, CH4, FLD_YT, UNIT_KWH, 56, 4, 1000, false, 3 }, { TYPE_DC, CH4, FLD_YT, UNIT_KWH, 16, 4, 1000, false, 3 },
{ TYPE_DC, CH4, FLD_YD, UNIT_WH, 64, 2, 1, false, 0 }, { TYPE_DC, CH4, FLD_YD, UNIT_WH, 22, 2, 1, false, 0 },
{ TYPE_DC, CH4, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH4, CMD_CALC, false, 3 }, { TYPE_DC, CH4, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH1, CMD_CALC, false, 3 },
{ TYPE_DC, CH5, FLD_UDC, UNIT_V, 46, 2, 10, false, 1 }, { TYPE_DC, CH5, FLD_UDC, UNIT_V, 2, 2, 10, false, 1 },
{ TYPE_DC, CH5, FLD_IDC, UNIT_A, 50, 2, 100, false, 2 }, { TYPE_DC, CH5, FLD_IDC, UNIT_A, 4, 2, 100, false, 2 },
{ TYPE_DC, CH5, FLD_PDC, UNIT_W, 54, 2, 10, false, 1 }, { TYPE_DC, CH5, FLD_PDC, UNIT_W, 8, 2, 10, false, 1 },
{ TYPE_DC, CH5, FLD_YT, UNIT_KWH, 60, 4, 1000, false, 3 }, { TYPE_DC, CH5, FLD_YT, UNIT_KWH, 12, 4, 1000, false, 3 },
{ TYPE_DC, CH5, FLD_YD, UNIT_WH, 66, 2, 1, false, 0 }, { TYPE_DC, CH5, FLD_YD, UNIT_WH, 20, 2, 1, false, 0 },
{ TYPE_DC, CH5, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH5, CMD_CALC, false, 3 }, { TYPE_DC, CH5, FLD_IRR, UNIT_PCT, CALC_IRR_CH, CH0, CMD_CALC, false, 3 },
{ TYPE_AC, CH0, FLD_UAC, UNIT_V, 74, 2, 10, false, 1 }, // dummy { TYPE_AC, CH0, FLD_UAC, UNIT_V, 74, 2, 10, false, 1 }, // dummy
{ TYPE_AC, CH0, FLD_UAC_1N, UNIT_V, 68, 2, 10, false, 1 }, { TYPE_AC, CH0, FLD_UAC_1N, UNIT_V, 68, 2, 10, false, 1 },

View File

@ -14,8 +14,12 @@ extra_configs =
platformio_override.ini platformio_override.ini
[env] [env]
; Make sure to NOT add any spaces in the custom_ci_action property
; (also the position in the file is important)
custom_ci_action = generic
framework = arduino framework = arduino
platform = espressif32@6.3.0 platform = espressif32@6.3.1
build_flags = build_flags =
-DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/js/app.js.gz -DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/js/app.js.gz
@ -30,8 +34,8 @@ lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer https://github.com/yubox-node-org/ESPAsyncWebServer
bblanchon/ArduinoJson @ ^6.21.2 bblanchon/ArduinoJson @ ^6.21.2
https://github.com/bertmelis/espMqttClient.git#v1.4.3 https://github.com/bertmelis/espMqttClient.git#v1.4.3
nrf24/RF24 @ ^1.4.5 nrf24/RF24 @ ^1.4.7
olikraus/U8g2 @ ^2.34.17 olikraus/U8g2 @ ^2.34.18
buelowp/sunset @ ^1.1.7 buelowp/sunset @ ^1.1.7
extra_scripts = extra_scripts =

View File

@ -28,6 +28,7 @@ void MqttHandleDtuClass::loop()
MqttSettings.publish("dtu/hostname", NetworkSettings.getHostname()); MqttSettings.publish("dtu/hostname", NetworkSettings.getHostname());
if (NetworkSettings.NetworkMode() == network_mode::WiFi) { if (NetworkSettings.NetworkMode() == network_mode::WiFi) {
MqttSettings.publish("dtu/rssi", String(WiFi.RSSI())); MqttSettings.publish("dtu/rssi", String(WiFi.RSSI()));
MqttSettings.publish("dtu/bssid", String(WiFi.BSSIDstr()));
} }
_lastPublish = millis(); _lastPublish = millis();

View File

@ -129,7 +129,6 @@ void MqttHandleInverterClass::publishField(std::shared_ptr<InverterAbstract> inv
String value = String( String value = String(
inv->Statistics()->getChannelFieldValue(type, channel, fieldId), inv->Statistics()->getChannelFieldValue(type, channel, fieldId),
static_cast<unsigned int>(inv->Statistics()->getChannelFieldDigits(type, channel, fieldId))); static_cast<unsigned int>(inv->Statistics()->getChannelFieldDigits(type, channel, fieldId)));
value.trim();
MqttSettings.publish(topic, value); MqttSettings.publish(topic, value);
} }

View File

@ -159,7 +159,11 @@ void MqttSettingsClass::publish(const String& subtopic, const String& payload)
{ {
String topic = getPrefix(); String topic = getPrefix();
topic += subtopic; topic += subtopic;
mqttClient->publish(topic.c_str(), 0, Configuration.get().Mqtt_Retain, payload.c_str());
String value = payload;
value.trim();
mqttClient->publish(topic.c_str(), 0, Configuration.get().Mqtt_Retain, value.c_str());
} }
void MqttSettingsClass::publishGeneric(const String& topic, const String& payload, bool retain, uint8_t qos) void MqttSettingsClass::publishGeneric(const String& topic, const String& payload, bool retain, uint8_t qos)

View File

@ -36,6 +36,7 @@ void WebApiNetworkClass::onNetworkStatus(AsyncWebServerRequest* request)
root["sta_status"] = ((WiFi.getMode() & WIFI_STA) != 0); root["sta_status"] = ((WiFi.getMode() & WIFI_STA) != 0);
root["sta_ssid"] = WiFi.SSID(); root["sta_ssid"] = WiFi.SSID();
root["sta_bssid"] = WiFi.BSSIDstr();
root["sta_rssi"] = WiFi.RSSI(); root["sta_rssi"] = WiFi.RSSI();
root["network_hostname"] = NetworkSettings.getHostname(); root["network_hostname"] = NetworkSettings.getHostname();
root["network_ip"] = NetworkSettings.localIP().toString(); root["network_ip"] = NetworkSettings.localIP().toString();

View File

@ -55,14 +55,14 @@ void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
if (SunPosition.sunriseTime(&timeinfo)) { if (SunPosition.sunriseTime(&timeinfo)) {
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo); strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
} else { } else {
strcpy(timeStringBuff, "--"); snprintf(timeStringBuff, sizeof(timeStringBuff), "--");
} }
root["sun_risetime"] = timeStringBuff; root["sun_risetime"] = timeStringBuff;
if (SunPosition.sunsetTime(&timeinfo)) { if (SunPosition.sunsetTime(&timeinfo)) {
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo); strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
} else { } else {
strcpy(timeStringBuff, "--"); snprintf(timeStringBuff, sizeof(timeStringBuff), "--");
} }
root["sun_settime"] = timeStringBuff; root["sun_settime"] = timeStringBuff;

View File

@ -53,6 +53,10 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
stream->print("# TYPE wifi_rssi gauge\n"); stream->print("# TYPE wifi_rssi gauge\n");
stream->printf("wifi_rssi %d\n", WiFi.RSSI()); stream->printf("wifi_rssi %d\n", WiFi.RSSI());
stream->print("# HELP wifi_bssid WiFi BSSID\n");
stream->print("# TYPE wifi_bssid gauge\n");
stream->printf("wifi_bssid %s\n", WiFi.BSSIDstr().c_str());
for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) { for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) {
auto inv = Hoymiles.getInverterByPos(i); auto inv = Hoymiles.getInverterByPos(i);

View File

@ -79,8 +79,10 @@ void WebApiWsLiveClass::loop()
_ws.textAll(buffer); _ws.textAll(buffer);
} }
} catch (std::bad_alloc& bad_alloc) { } catch (const std::bad_alloc& bad_alloc) {
MessageOutput.printf("Call to /api/livedata/status temporarely out of resources. Reason: \"%s\".\r\n", bad_alloc.what()); MessageOutput.printf("Call to /api/livedata/status temporarely out of resources. Reason: \"%s\".\r\n", bad_alloc.what());
} catch (const std::exception& exc) {
MessageOutput.printf("Unknown exception in /api/livedata/status. Reason: \"%s\".\r\n", exc.what());
} }
_lastWsPublish = millis(); _lastWsPublish = millis();
@ -229,9 +231,11 @@ void WebApiWsLiveClass::onLivedataStatus(AsyncWebServerRequest* request)
response->setLength(); response->setLength();
request->send(response); request->send(response);
} catch (std::bad_alloc& bad_alloc) { } catch (const std::bad_alloc& bad_alloc) {
MessageOutput.printf("Call to /api/livedata/status temporarely out of resources. Reason: \"%s\".\r\n", bad_alloc.what()); MessageOutput.printf("Call to /api/livedata/status temporarely out of resources. Reason: \"%s\".\r\n", bad_alloc.what());
WebApi.sendTooManyRequests(request);
} catch (const std::exception& exc) {
MessageOutput.printf("Unknown exception in /api/livedata/status. Reason: \"%s\".\r\n", exc.what());
WebApi.sendTooManyRequests(request); WebApi.sendTooManyRequests(request);
} }
} }

View File

@ -24,7 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@intlify/unplugin-vue-i18n": "^0.11.0", "@intlify/unplugin-vue-i18n": "^0.11.0",
"@rushstack/eslint-patch": "^1.3.0", "@rushstack/eslint-patch": "^1.3.1",
"@tsconfig/node18": "^2.0.1", "@tsconfig/node18": "^2.0.1",
"@types/bootstrap": "^5.2.6", "@types/bootstrap": "^5.2.6",
"@types/node": "^20.2.5", "@types/node": "^20.2.5",
@ -33,10 +33,10 @@
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-typescript": "^11.0.3", "@vue/eslint-config-typescript": "^11.0.3",
"@vue/tsconfig": "^0.4.0", "@vue/tsconfig": "^0.4.0",
"eslint": "^8.41.0", "eslint": "^8.42.0",
"eslint-plugin-vue": "^9.14.1", "eslint-plugin-vue": "^9.14.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"sass": "^1.62.1", "sass": "^1.62.2",
"terser": "^5.17.7", "terser": "^5.17.7",
"typescript": "^5.1.3", "typescript": "^5.1.3",
"vite": "^4.3.9", "vite": "^4.3.9",

View File

@ -13,6 +13,10 @@
<th>{{ $t('wifistationinfo.Ssid') }}</th> <th>{{ $t('wifistationinfo.Ssid') }}</th>
<td>{{ networkStatus.sta_ssid }}</td> <td>{{ networkStatus.sta_ssid }}</td>
</tr> </tr>
<tr>
<th>{{ $t('wifistationinfo.Bssid') }}</th>
<td>{{ networkStatus.sta_bssid }}</td>
</tr>
<tr> <tr>
<th>{{ $t('wifistationinfo.Quality') }}</th> <th>{{ $t('wifistationinfo.Quality') }}</th>
<td>{{ $n(getRSSIasQuality(networkStatus.sta_rssi), 'percent') }}</td> <td>{{ $n(getRSSIasQuality(networkStatus.sta_rssi), 'percent') }}</td>

View File

@ -208,6 +208,7 @@
"Enabled": "aktiv", "Enabled": "aktiv",
"Disabled": "nicht aktiv", "Disabled": "nicht aktiv",
"Ssid": "SSID", "Ssid": "SSID",
"Bssid": "BSSID",
"Quality": "Qualität", "Quality": "Qualität",
"Rssi": "RSSI" "Rssi": "RSSI"
}, },

View File

@ -208,6 +208,7 @@
"Enabled": "enabled", "Enabled": "enabled",
"Disabled": "disabled", "Disabled": "disabled",
"Ssid": "SSID", "Ssid": "SSID",
"Bssid": "BSSID",
"Quality": "Quality", "Quality": "Quality",
"Rssi": "RSSI" "Rssi": "RSSI"
}, },

View File

@ -208,6 +208,7 @@
"Enabled": "activé", "Enabled": "activé",
"Disabled": "désactivé", "Disabled": "désactivé",
"Ssid": "SSID", "Ssid": "SSID",
"Bssid": "BSSID",
"Quality": "Qualité", "Quality": "Qualité",
"Rssi": "RSSI" "Rssi": "RSSI"
}, },

View File

@ -2,6 +2,7 @@ export interface NetworkStatus {
// WifiStationInfo // WifiStationInfo
sta_status: boolean; sta_status: boolean;
sta_ssid: string; sta_ssid: string;
sta_bssid: string;
sta_rssi: number; sta_rssi: number;
// WifiApInfo // WifiApInfo
ap_status: boolean; ap_status: boolean;

View File

@ -156,15 +156,15 @@
minimatch "^3.1.2" minimatch "^3.1.2"
strip-json-comments "^3.1.1" strip-json-comments "^3.1.1"
"@eslint/js@8.41.0": "@eslint/js@8.42.0":
version "8.41.0" version "8.42.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.41.0.tgz#080321c3b68253522f7646b55b577dd99d2950b3" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.42.0.tgz#484a1d638de2911e6f5a30c12f49c7e4a3270fb6"
integrity sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA== integrity sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw==
"@humanwhocodes/config-array@^0.11.8": "@humanwhocodes/config-array@^0.11.10":
version "0.11.8" version "0.11.10"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2"
integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==
dependencies: dependencies:
"@humanwhocodes/object-schema" "^1.2.1" "@humanwhocodes/object-schema" "^1.2.1"
debug "^4.1.1" debug "^4.1.1"
@ -345,10 +345,10 @@
estree-walker "^2.0.2" estree-walker "^2.0.2"
picomatch "^2.3.1" picomatch "^2.3.1"
"@rushstack/eslint-patch@^1.3.0": "@rushstack/eslint-patch@^1.3.1":
version "1.3.0" version "1.3.1"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.0.tgz#f5635b36fc0dad96ef1e542a302cd914230188c0" resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.1.tgz#edbb85ff95f3be41eaa70c6d6ad6d8ba0a9c7e46"
integrity sha512-IthPJsJR85GhOkp3Hvp8zFOPK5ynKn6STyHa/WZpioK7E1aYDiBzpqQPrngc14DszIUkIrdd3k9Iu0XSzlP/1w== integrity sha512-RkmuBcqiNioeeBKbgzMlOdreUkJfYaSjwgx9XDgGGpjvWgyaxWvDmZVSN9CS6LjEASadhgPv2BcFp+SeouWXXA==
"@tsconfig/node18@^2.0.1": "@tsconfig/node18@^2.0.1":
version "2.0.1" version "2.0.1"
@ -1184,16 +1184,16 @@ eslint-visitor-keys@^3.4.1:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994"
integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==
eslint@^8.41.0: eslint@^8.42.0:
version "8.41.0" version "8.42.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.41.0.tgz#3062ca73363b4714b16dbc1e60f035e6134b6f1c" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.42.0.tgz#7bebdc3a55f9ed7167251fe7259f75219cade291"
integrity sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q== integrity sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A==
dependencies: dependencies:
"@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/eslint-utils" "^4.2.0"
"@eslint-community/regexpp" "^4.4.0" "@eslint-community/regexpp" "^4.4.0"
"@eslint/eslintrc" "^2.0.3" "@eslint/eslintrc" "^2.0.3"
"@eslint/js" "8.41.0" "@eslint/js" "8.42.0"
"@humanwhocodes/config-array" "^0.11.8" "@humanwhocodes/config-array" "^0.11.10"
"@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/module-importer" "^1.0.1"
"@nodelib/fs.walk" "^1.2.8" "@nodelib/fs.walk" "^1.2.8"
ajv "^6.10.0" ajv "^6.10.0"
@ -2220,10 +2220,10 @@ safe-regex-test@^1.0.0:
get-intrinsic "^1.1.3" get-intrinsic "^1.1.3"
is-regex "^1.1.4" is-regex "^1.1.4"
sass@^1.62.1: sass@^1.62.2:
version "1.62.1" version "1.63.2"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.62.1.tgz#caa8d6bf098935bc92fc73fa169fb3790cacd029" resolved "https://registry.yarnpkg.com/sass/-/sass-1.63.2.tgz#75f7d9a8e67d1d5b98a989507f4d98b6067b1f75"
integrity sha512-NHpxIzN29MXvWiuswfc1W3I0N8SXBd8UR26WntmDlRYf0bSADnwnOjsyMZ3lMezSlArD33Vs3YFhp7dWvL770A== integrity sha512-u56TU0AIFqMtauKl/OJ1AeFsXqRHkgO7nCWmHaDwfxDo9GUMSqBA4NEh6GMuh1CYVM7zuROYtZrHzPc2ixK+ww==
dependencies: dependencies:
chokidar ">=3.0.0 <4.0.0" chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0" immutable "^4.0.0"