Skip to content

Commit

Permalink
Release 3.3.1 (#117)
Browse files Browse the repository at this point in the history
* change to 3.3.1, update ElegantOTA, fix custom firmware upload

* Update modbus.cpp

ID Daten per MQTT

* Create Solax-X3-PRO.json

* Update Solax-X3.json

* fix null-termination of string handling  (#96)

* some additional infos per mqtt with debuglevel > 4

some additional infos per mqtt with debuglevel > 4
- memory in kB
- uptime in sec
- wifi ssid

* Update mqtt.cpp

* Update mqtt.cpp

* Update modbus.cpp

* support for OpenWB 2.0 Api (#100)

* update

* remove unused buffer and improve clarity

* Update modbus.cpp

* minor fixes

* add optional WIFISSID/WIFIPASSWORD

* change ESP32-S2 board

* adjust openWB topics

* fix

* priorize requesting ID Data higher than LiveData (#76)

* update WiFi credentials in platformio.ini to use fixed values

* some fixes

* Update modbus.cpp

* Update modbus.cpp

* delete unnecessary newlines, fix serial-pins

* Update modbus.cpp

* Update modbus.cpp

* Update modbus.cpp

* use checkbox for selection instead of radiobuttons

* Revert "use checkbox for selection instead of radiobuttons"

This reverts commit 04f39f9.

* prevent watchdog timer event

* update

* Update modbus.cpp

* add TotalEnergyPV for GroWatt (#100)

* bugfix: fix esp crash for /getitems if using an huge register table (#76)

* use internal logging method

* fix register id definition (#113)

* remove unnecessary webserver in mqtt class

* remove unnecessary webserver in mqtt class

* handle out-of-range crash (#96 #113)

* correct unit from kVarh to kWh in Deye_SUN_SG04LP3.json

* add bitwise mappings

* datatype "binary" now available for json register definitions (PR #115)

* fix openwb topic (#114)

* fix array access direction for datatype binary (PR #115)

* fix: 1 item less than map size, because last item is default value

---------

Co-authored-by: Lazgar <[email protected]>
  • Loading branch information
tobiasfaust and Lazgar authored Jan 10, 2025
1 parent 9b1eed4 commit 5a4c926
Show file tree
Hide file tree
Showing 33 changed files with 1,626 additions and 1,181 deletions.
13 changes: 13 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Release 3.3.1:
- new Feature: datatype "binary" now available for json register definitions (PR #115)
- BugFix: fix null-terminationof string handling (#96)
- new feature: support for OpenWB 2.0 Api (#100)
- bugfix: fix esp crash for /getitems if using an huge register table (#76)

Release 3.3.0:
- new feature: WebSerial as remote serial output (#74)
- new feature: configurable serial output pins
Expand All @@ -12,6 +18,13 @@ Release 3.3.0:
- move config files from root to subfolder /config
- new feature: Backup/Restore of configfiles for OTA

**Breaking changes**
From release 0.7 onwards, an access point will no longer be opened during an initial installation. The WiFi access data must be entered via the web installer. This is used for both initial installation and entry of WiFi access data.
When updating version 0.6 to 0.7, a new installation must also be carried out because the WiFi handling has been switched to the ImprovWiFi Library.
If version 0.7 is already installed on the ESP device, an OTA update is sufficient. See “Update” button at ESP-webinterface

Detailed instructions can be found in the [WiKi](https://github.com/tobiasfaust/SolaxModbusGateway/wiki)

Release 3.2.2:
- new feature: GoodWe Support, by @TigerGrey (#58)
- new feature: support for id and livedate on same functioncode, by @TigerGrey (#58)
Expand Down
37 changes: 14 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Modbus-RTU to MQTT Gateway
**for Solar Inverters and other Modbus-RTU Devices**
# Modbus-RTU to MQTT Gateway for Solar Inverter

[![license](https://img.shields.io/badge/Licence-GNU%20v3.0-green)](https://github.com/desktop/desktop/blob/master/LICENSE)
![ESP32 Architecture](https://img.shields.io/badge/Architecture-ESP32-blue)
Expand All @@ -14,13 +13,12 @@ I want to integrate the professional WebSerial and professional ElegantOTA Editi

-----

This project implements a Gateway for Solar Inverters with Modbus-RTU communication to MQTT on ESP32 basis.
Direkt Communication with [OpenWB](https://openwb.de) is implemented.
Sending "set" commands to inverter are basically implemented too.
This project implements a Gatewayx for Solar Inverter with with Modbus-RTU communication to MQTT on ESP32 basis.
Direkt Communication wit [OpenWB](https://openwb.de) is implemented.

### Supported Solar Inverters
Basically, all Inverters with Modbus RS485 RTU communication are supported.
Currently the following Inverters with their special registers are integrated:
### Supported Solar Inverter
Basically, all Inverters with Modbus RS485 RTU communication.
Currently the following Inverters are with thier special registers integrated:
* Solax Hybrid X1
* Solax Hybrid X3
* Solax MIC
Expand All @@ -29,28 +27,21 @@ Currently the following Inverters with their special registers are integrated:
* Deye Sun SG04LP3
* QVolt-HYP-G3-3P

If your Solar Inverter is not listed, it´s quite simple to add it by yourself. Feel free to add the special registers, please check the [wiki page](https://github.com/tobiasfaust/SolaxModbusGateway/wiki/configuration-register) or contact me by opening a [new issue](https://github.com/tobiasfaust/SolaxModbusGateway/issues) in github.
If your Solar Inverter is not listed, feel free to add the special register simply, please check th [wiki page](configuration-register) or contact me by opening a [new issue](https://github.com/tobiasfaust/SolaxModbusGateway/issues) in github.

### What you need
* ESP32, ESP32-C3, ESP-S2 or ESP-S3 NodeMCU
* RS-485 TTL UART Module with MAX485 Semiconductor
* ESP32 NodeMCU
* MAX485 Module TTL Switch Schalter to RS-485 Module RS485 5V Modul (this can also handle 3.3V from ESP)

An ESP8266 is actually not sufficient, because Modbus communication works fail-free only with hardwareserial. ESP8266 has only one Hardwareserial port which is used by serial/debug output. ESP32 has 3 Hardewareserial ports and we use one of them. Another reason is available memory for such huge json definition or such large modbus answers.
Please check also the wiki page, [how to wire the circuit](https://github.com/tobiasfaust/SolaxModbusGateway/wiki/wiring-the-circuit).
Please check also the wiki page, [how to wire the circuit](wiring-the-circuit).

### How to start
It´s recommend to start with one example to check wiring works correctly. Both LED´s (TX and RX) on your RS-485 module should blink. If only TX-LED blinks, please check:
* wiring
* baud rate
It's the easiest way you've ever heard: Just go to the [Web-Installer](https://tobiasfaust.github.io/SolaxModbusGateway/) and follow the [Wiki documentation](https://github.com/tobiasfaust/SolaxModbusGateway/wiki/start-and-integration-into-locale-wifi)

The example requests the inverter SerialNumber and if wiring is correct, the inverter will answer with his number or something like this.
After that your Device is ready and looks like this:

<pre>
request: 01 03 00 00 00 07 08 04
[[images/Solax_Status.png]]

Response: 01 03 .....
</pre>

Burn firmware on your device via web-installer: https://tobiasfaust.github.io/SolaxModbusGateway/

## please refer full documentation and How-To´s in our [Wiki](https://github.com/tobiasfaust/SolaxModbusGateway/wiki)
There is also a page with all configured livedata items available. This page is refreshing every 5 seconds. Please check [Modbus Item Configuration page](configuration-modbusitems).
25 changes: 25 additions & 0 deletions data/misc/openwb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"version": "1.9",
"topics": [
{ "setpvw": "openWB/set/pv/#InverterID#/W" },
{ "setbatw": "openWB/set/houseBattery/W"},
{ "setbatsoc": "openWB/set/houseBattery/%Soc"},
{ "setbatexpwh": "openWB/set/houseBattery/WhExported"},
{ "setbatimpwh": "openWB/set/houseBattery/WhImported"},
{ "setcounterwh": "openWB/set/pv/#InverterID#/WhCounter"}
]
},
{
"version": "2.0",
"topics": [
{ "setpvw": "openWB/set/pv/#InverterID#/get/power" },
{ "setbatw": "openWB/set/bat/#BatteryID#/get/power"},
{ "setbatsoc": "openWB/set/bat/#BatteryID#/get/soc"},
{ "setbatexpwh": "openWB/set/bat/#BatteryID#/get/exported"},
{ "setbatimpwh": "openWB/set/bat/#BatteryID#/get/imported"},
{ "setcounterwh": " openWB/set/pv/#InverterID#/get/exported"}

]
}
]
20 changes: 17 additions & 3 deletions data/regs/Deye_SUN_SG04LP3.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"realname": "Reactive Power Generation of Today",
"datatype": "float",
"factor": 0.1,
"unit": "kVarh"
"unit": "kWh"
},
{
"position": [
Expand Down Expand Up @@ -325,6 +325,20 @@
"factor": 0.1,
"unit": "KWh"
},
{
"position": [
73,
74,
71,
72
],
"name": "TotalPVPowerWh",
"realname": "Total PV Power in Wh",
"datatype": "float",
"factor": 100,
"openwbtopic": "setcounterwh",
"unit": "KWh"
},
{
"position": [
81,
Expand Down Expand Up @@ -1226,8 +1240,8 @@
15,
16
],
"name": "SN",
"realname": "SerialNumber",
"name": "InverterSN",
"realname": "Inverter SerialNumber",
"datatype": "string"
}
]
Expand Down
31 changes: 19 additions & 12 deletions data/regs/Growatt-MOD.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
],
"name": "InputPower",
"realname": "Erzeugungsleistung Gesamt",
"openwbtopic": "openWB/set/pv/W",
"openwbtopic": "setpvw",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand All @@ -94,7 +94,6 @@
],
"name": "PowerPv1",
"realname": "Erzeugungsleistung Pv1",
"openwbtopic": "openWB/set/pv/1/W",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand Down Expand Up @@ -130,7 +129,6 @@
],
"name": "PowerPv2",
"realname": "Erzeugungsleistung Pv2",
"openwbtopic": "openWB/set/pv/2/W",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand Down Expand Up @@ -323,6 +321,20 @@
"factor": 0.1,
"unit": "KWh"
},
{
"position": [
113,
114,
115,
116
],
"name": "TotalEnergyGeneratedWh",
"realname": "Erzeugte Energie Gesamt in Wh",
"datatype": "integer",
"openwbtopic": "setcounterwh",
"factor": 100,
"unit": "KWh"
},
{
"position": [
117,
Expand All @@ -345,7 +357,6 @@
],
"name": "TodayEnergyKWhPv1",
"realname": "Erzeugte Energie Pv1 heute",
"openwbtopic": "openWB/set/pv/1/WhCounter",
"datatype": "integer",
"factor": 0.1,
"unit": "KWh"
Expand All @@ -359,7 +370,6 @@
],
"name": "TotalEnergyWhPv1",
"realname": "Erzeugte Energie Pv1 in Wh",
"openwbtopic": "openWB/set/pv/1/WhCounter",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -373,7 +383,6 @@
],
"name": "TodayEnergyKWhPv2",
"realname": "Erzeugte Energie Pv2 heute",
"openwbtopic": "openWB/set/pv/2/WhCounter",
"datatype": "integer",
"factor": 0.1,
"unit": "KWh"
Expand All @@ -387,7 +396,6 @@
],
"name": "TotalEnergyWhPv2",
"realname": "Erzeugte Energie Pv2 in Wh",
"openwbtopic": "openWB/set/pv/2/WhCounter",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -401,7 +409,6 @@
],
"name": "TotalEnergyKwhPv2",
"realname": "Erzeugte Energie Pv2 in Kwh",
"openwbtopic": "openWB/set/pv/2/WhCounter",
"datatype": "float",
"factor": 0.1,
"unit": "KWh"
Expand Down Expand Up @@ -435,7 +442,7 @@
],
"name": "BatChargingPower",
"realname": "Battery Charging Power",
"openwbtopic": "openWB/set/houseBattery/W",
"openwbtopic": "setbatimpwh",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand Down Expand Up @@ -609,7 +616,7 @@
],
"name": "BatCapacity",
"realname": "Battery Capacity (SOC)",
"openwbtopic": "openWB/set/houseBattery/%Soc",
"openwbtopic": "setbatsoc",
"datatype": "integer",
"unit": "%"
},
Expand All @@ -622,7 +629,7 @@
],
"name": "InputEnergyChargeWh",
"realname": "Geladene Energie Speicher (Wh)",
"openwbtopic": "openWB/set/houseBattery/WhImported",
"openwbtopic": "setbatimpwh",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -649,7 +656,7 @@
],
"name": "OutputEnergyChargeWh",
"realname": "Entladene Energie Speicher (Wh)",
"openwbtopic": "openWB/set/houseBattery/WhExported",
"openwbtopic": "setbatexpwh",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand Down
32 changes: 20 additions & 12 deletions data/regs/Growatt-SPH.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
["#ClientID", "0x04", "0x03", "0xE8", "0x00", "0x77"]
],
"RequestIdData": [
["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x14"]
["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x20"]
],
"ClientIdPos": 0,
"LiveDataFunctionCodePos": 1,
Expand Down Expand Up @@ -38,7 +38,7 @@
"position": [5, 6, 7, 8],
"name": "InputPower",
"realname": "Erzeugungsleistung Gesamt",
"openwbtopic": "openWB/set/pv/W",
"openwbtopic": "setpvw",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand All @@ -47,7 +47,6 @@
"position": [13, 14, 15, 16],
"name": "PowerPv1",
"realname": "Erzeugungsleistung Pv1",
"openwbtopic": "openWB/set/pv/1/W",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand All @@ -56,7 +55,6 @@
"position": [21, 22, 23, 24],
"name": "PowerPv2",
"realname": "Erzeugungsleistung Pv2",
"openwbtopic": "openWB/set/pv/2/W",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand All @@ -69,11 +67,24 @@
"factor": 0.01,
"unit": "Hz"
},
{
"position": [
185,
186,
187,
188
],
"name": "TotalEnergyPV",
"realname": "Erzeugte Energie PV",
"openwbtopic": "setcounterwh",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
},
{
"position": [125, 126, 127, 128],
"name": "TotalEnergyWhPv1",
"realname": "Erzeugte Energie Pv1 in Wh",
"openwbtopic": "openWB/set/pv/1/WhCounter",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -82,7 +93,6 @@
"position": [125, 126, 127, 128],
"name": "TotalEnergyKwhPv1",
"realname": "Erzeugte Energie Pv1 in Kwh",
"openwbtopic": "openWB/set/pv/1/WhCounter",
"datatype": "float",
"factor": 0.1,
"unit": "KWh"
Expand All @@ -91,7 +101,6 @@
"position": [133, 134, 135, 136],
"name": "TotalEnergyWhPv2",
"realname": "Erzeugte Energie Pv2 in Wh",
"openwbtopic": "openWB/set/pv/2/WhCounter",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -100,7 +109,6 @@
"position": [133, 134, 135, 136],
"name": "TotalEnergyKwhPv2",
"realname": "Erzeugte Energie Pv2 in Kwh",
"openwbtopic": "openWB/set/pv/2/WhCounter",
"datatype": "float",
"factor": 0.1,
"unit": "KWh"
Expand All @@ -118,7 +126,7 @@
"position2": [264, 265, 266, 267],
"name": "BatChargingPower",
"realname": "Battery Charging Power",
"openwbtopic": "openWB/set/houseBattery/W",
"openwbtopic": "setbatw",
"datatype": "float",
"factor": 0.1,
"unit": "W"
Expand All @@ -127,15 +135,15 @@
"position": [274, 275],
"name": "BatCapacity",
"realname": "Battery Capacity (SOC)",
"openwbtopic": "openWB/set/houseBattery/%Soc",
"openwbtopic": "setbatsoc",
"datatype": "integer",
"unit": "%"
},
{
"position": [362, 363, 364, 365],
"name": "InputEnergyChargeWh",
"realname": "Geladene Energie Speicher (Wh)",
"openwbtopic": "openWB/set/houseBattery/WhImported",
"openwbtopic": "setbatimpwh",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand All @@ -152,7 +160,7 @@
"position": [354, 355, 356, 357],
"name": "OutputEnergyChargeWh",
"realname": "Entladene Energie Speicher (Wh)",
"openwbtopic": "openWB/set/houseBattery/WhExported",
"openwbtopic": "setbatexpwh",
"datatype": "integer",
"factor": 100,
"unit": "Wh"
Expand Down
Loading

0 comments on commit 5a4c926

Please sign in to comment.