diff --git a/.github/ISSUE_TEMPLATE/report-ahoy.md b/.github/ISSUE_TEMPLATE/report-ahoy.md
index cae74fcd..1f361271 100644
--- a/.github/ISSUE_TEMPLATE/report-ahoy.md
+++ b/.github/ISSUE_TEMPLATE/report-ahoy.md
@@ -33,18 +33,29 @@ connected between +3.3V and GND (Pin 1 & 2) of the NRF Module
* [ ] Image of the your wiring attached
### Connection diagram I used:
-| nRF24L01+ Pin | ESP8266/32 GPIO |
+| nRF24L01+ Pin | ESP8266 GPIO |
+| ------------- | -------------- |
+| Pin 1 GND [*] | GND |
+| Pin 2 +3.3V | +3.3V |
+| Pin 3 CE | GPIO2 CE D4 |
+| Pin 4 CSN | GPIO15 CS D8 |
+| Pin 5 SCK | GPIO14 SCLK D5 |
+| Pin 6 MOSI | GPIO13 MOSI D7 |
+| Pin 7 MISO | GPIO12 MISO D6 |
+| Pin 8 IRQ | GPIO0 IRQ D3 |
+
+| nRF24L01+ Pin | ESP32 GPIO |
| ------------- | --------------- |
-| Pin 1 GND [] | GND |
-| Pin 2 +3.3V | +3.3V |
-| Pin 3 CE | GPIO_2/_4 CE |
-| Pin 4 CSN | GPIO15/_5 CS |
-| Pin 5 SCK | GPIO14/18 SCLK |
-| Pin 6 MOSI | GPIO13/23 MOSI |
-| Pin 7 MISO | GPIO12/19 MISO |
-| Pin 8 IRQ | GPIO_0/0 IRQ |
+| Pin 1 GND [*] | GND |
+| Pin 2 +3.3V | +3.3V |
+| Pin 3 CE | GPIO4 CE D4 |
+| Pin 4 CSN | GPIO5 CS D5 |
+| Pin 5 SCK | GPIO18 SCLK D18 |
+| Pin 6 MOSI | GPIO23 MOSI D23 |
+| Pin 7 MISO | GPIO19 MISO D19 |
+| Pin 8 IRQ | GPIO0 IRQ D0 |
-Note: [] GND Pin 1 has a square mark on the nRF24L01+ module
+Note: [*] GND Pin 1 has a square mark on the nRF24L01+ module
## Software
* [ ] AhoyDTU
diff --git a/.github/ISSUE_TEMPLATE/report.yaml b/.github/ISSUE_TEMPLATE/report.yaml
index 9f81e554..6c834480 100644
--- a/.github/ISSUE_TEMPLATE/report.yaml
+++ b/.github/ISSUE_TEMPLATE/report.yaml
@@ -81,18 +81,29 @@ body:
description: Tell us which connection diagram you used?
value: |
## Connection diagram I used:
- | nRF24L01+ Pin | ESP8266/32 GPIO |
+ | nRF24L01+ Pin | ESP8266 GPIO |
+ | ------------- | -------------- |
+ | Pin 1 GND [*] | GND |
+ | Pin 2 +3.3V | +3.3V |
+ | Pin 3 CE | GPIO2 CE D4 |
+ | Pin 4 CSN | GPIO15 CS D8 |
+ | Pin 5 SCK | GPIO14 SCLK D5 |
+ | Pin 6 MOSI | GPIO13 MOSI D7 |
+ | Pin 7 MISO | GPIO12 MISO D6 |
+ | Pin 8 IRQ | GPIO0 IRQ D3 |
+
+ | nRF24L01+ Pin | ESP32 GPIO |
| ------------- | --------------- |
- | Pin 1 GND [] | GND |
- | Pin 2 +3.3V | +3.3V |
- | Pin 3 CE | GPIO_2/_4 CE |
- | Pin 4 CSN | GPIO15/_5 CS |
- | Pin 5 SCK | GPIO14/18 SCLK |
- | Pin 6 MOSI | GPIO13/23 MOSI |
- | Pin 7 MISO | GPIO12/19 MISO |
- | Pin 8 IRQ | GPIO_0/0 IRQ |
-
- Note: [] GND Pin 1 has a square mark on the nRF24L01+ module
+ | Pin 1 GND [*] | GND |
+ | Pin 2 +3.3V | +3.3V |
+ | Pin 3 CE | GPIO4 CE D4 |
+ | Pin 4 CSN | GPIO5 CS D5 |
+ | Pin 5 SCK | GPIO18 SCLK D18 |
+ | Pin 6 MOSI | GPIO23 MOSI D23 |
+ | Pin 7 MISO | GPIO19 MISO D19 |
+ | Pin 8 IRQ | GPIO0 IRQ D0 |
+
+ Note: [*] GND Pin 1 has a square mark on the nRF24L01+ module
validations:
required: true
- type: checkboxes
diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml
index 218996f2..ffde2d21 100644
--- a/.github/workflows/compile_development.yml
+++ b/.github/workflows/compile_development.yml
@@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: development03
- - uses: benjlevesque/short-sha@v2.0
+ - uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
length: 7
@@ -43,16 +43,16 @@ jobs:
pip install --upgrade platformio
- name: Convert HTML files
- working-directory: tools/esp8266/html
+ working-directory: src/web/html
run: python convert.py
- name: Run PlatformIO
- run: pio run -d tools/esp8266 --environment esp8266-release --environment esp8266-1m-release --environment esp32-wroom32-release
+ run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
- name: Rename Binary files
id: rename-binary-files
- working-directory: tools/esp8266/scripts
- run: python getVersion.py
+ working-directory: src
+ run: python ../scripts/getVersion.py >> $GITHUB_OUTPUT
- name: Set Version
uses: cschleiden/replace-tokens@v1
@@ -61,9 +61,16 @@ jobs:
env:
VERSION: ${{ steps.rename-binary-files.outputs.name }}
+ - name: Create Manifest
+ working-directory: src
+ run: python ../scripts/buildManifest.py
+
- name: Create Artifact
- run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip tools/esp8266/.pio/build/out/* tools/esp8266/User_Manual.md
- - uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v3
with:
- name: ${{ steps.rename-binary-files.outputs.name }}_dev_build
- path: ./${{ steps.rename-binary-files.outputs.name }}.zip
+ name: ahoydtu_dev
+ path: |
+ src/firmware/*
+ src/User_Manual.md
+ src/install.html
+
diff --git a/.github/workflows/compile_esp8266.yml b/.github/workflows/compile_release.yml
similarity index 70%
rename from .github/workflows/compile_esp8266.yml
rename to .github/workflows/compile_release.yml
index e989235c..84ad5111 100644
--- a/.github/workflows/compile_esp8266.yml
+++ b/.github/workflows/compile_release.yml
@@ -4,10 +4,11 @@ on:
push:
branches: main
paths:
- - 'tools/esp8266/**' # build only when changes occur here
- - '!tools/esp8266/README.md'
- - '!tools/esp8266/CHANGES.md'
- - '!tools/esp8266/User_Manual.md'
+ - 'src/**' # build only when changes occur here
+ - '.github/workflows/compile_release.yml'
+ - '!README.md'
+ - '!CHANGES.md'
+ - '!User_Manual.md'
jobs:
build:
runs-on: ubuntu-latest
@@ -16,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: main
- - uses: benjlevesque/short-sha@v2.0
+ - uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
length: 7
@@ -46,16 +47,18 @@ jobs:
pip install --upgrade platformio
- name: Convert HTML files
- working-directory: tools/esp8266/html
+ working-directory: src/web/html
run: python convert.py
+
- name: Run PlatformIO
- run: pio run -d tools/esp8266 --environment esp8266-release --environment esp8266-1m-release --environment esp32-wroom32-release
+ run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
- name: Rename Binary files
id: rename-binary-files
- working-directory: tools/esp8266/scripts
- run: python getVersion.py
- - name: create-release
+ working-directory: src
+ run: python ../scripts/getVersion.py >> $GITHUB_OUTPUT
+
+ - name: Create Release
id: create-release
uses: actions/create-release@v1
with:
@@ -63,18 +66,21 @@ jobs:
prerelease: false
release_name: ${{ steps.rename-binary-files.outputs.name }}
tag_name: ${{ steps.rename-binary-files.outputs.name }}
- body_path: tools/esp8266/CHANGES.md
+ body_path: src/CHANGES.md
env:
GITHUB_TOKEN: ${{ github.token }}
- - name: set-version
+
+ - name: Set Version
uses: cschleiden/replace-tokens@v1
with:
- files: tools/esp8266/User_Manual.md
+ files: User_Manual.md
env:
VERSION: ${{ steps.rename-binary-files.outputs.name }}
- - name: create-artifact
- run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip tools/esp8266/.pio/build/out/* tools/esp8266/User_Manual.md
- - name: upload-release
+
+ - name: Create Artifact
+ run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* User_Manual.md
+
+ - name: Upload Release
id: upload-release
uses: actions/upload-release-asset@v1
env:
diff --git a/.gitignore b/.gitignore
index 9af41f40..2ee4b679 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,24 +1,15 @@
-CMakeLists.txt.user
-CMakeCache.txt
-CMakeFiles
-CMakeScripts
-Testing
-Makefile
-cmake_install.cmake
-install_manifest.txt
-compile_commands.json
-CTestTestfile.cmake
-_deps
-build
-tools/esp8266/tmp
-tools/esp8266/binaries
+.pio
+.vscode/.browse.c_cpp.db*
+.vscode/c_cpp_properties.json
+.vscode/launch.json
+.vscode/ipch
+.vscode/extensions.json
+src/config/config_override.h
+src/web/html/h/*
+src/web/html/tmp/*
/**/Debug
/**/v16/*
*.db
*.suo
*.ipch
-tools/esp8266/.vscode/extensions.json
-.DS_Store
-.vscode
-tools/esp8266/platformio-device-monitor-*.log
-tools/esp8266/html/h/*
\ No newline at end of file
+src/output.map
diff --git a/tools/esp8266/README.md b/Getting_Started.md
similarity index 71%
rename from tools/esp8266/README.md
rename to Getting_Started.md
index 18f00c17..e73277f0 100644
--- a/tools/esp8266/README.md
+++ b/Getting_Started.md
@@ -1,3 +1,22 @@
+## Overview
+
+This page describes how the module of a Wemos D1 mini and ESP8266 is wired to the radio module and is flashed with the latest Firmware.
+Further information will help you to communicate to the compatible inverters.
+
+You find the full [User_Manual here](User_Manual.md)
+
+## Compatiblity
+
+For now the following Inverters should work out of the box:
+
+Hoymiles Inverters
+
+| Status | Serie | Model | comment |
+| ----- | ----- | ------ | ------- |
+| ✔️ | MI | 300, 600, 1000/1200/⚠️ 1500 | 4-Channel is not tested yet |
+| ✔️ | HM | 300, 350, 400, 600, 700, 800, 1000?, 1200, 1500 | |
+| ⚠️ | TSUN | [TSOL-M350](https://www.tsun-ess.com/Micro-Inverter/M350-M400), [TSOL-M400](https://www.tsun-ess.com/Micro-Inverter/M350-M400), [TSOL-M800/TSOL-M800(DE)](https://www.tsun-ess.com/Micro-Inverter/M800) | others may work as well (need to be verified). |
+
## Table of Contents
- [Table of Contents](#table-of-contents)
@@ -6,9 +25,12 @@
- [Things needed](#things-needed)
- [There are fake NRF24L01+ Modules out there](#there-are-fake-nrf24l01-modules-out-there)
- [Wiring things up](#wiring-things-up)
- - [ESP8266 wiring example](#esp8266-wiring-example)
+ - [ESP8266 wiring example on WEMOS D1](#esp8266-wiring-example)
- [Schematic](#schematic)
- [Symbolic view](#symbolic-view)
+ - [ESP8266 wiring example on 30pin Lolin NodeMCU v3](#esp8266-wiring-example-2)
+ - [Schematic](#schematic-2)
+ - [Symbolic view](#symbolic-view-2)
- [ESP32 wiring example](#esp32-wiring-example)
- [Schematic](#schematic-1)
- [Symbolic view](#symbolic-view-1)
@@ -23,39 +45,13 @@
- [HTTP based Pages](#http-based-pages)
- [MQTT command to set the DTU without webinterface](#mqtt-command-to-set-the-dtu-without-webinterface)
- [Used Libraries](#used-libraries)
-- [Contact](#contact)
- [ToDo](#todo)
***
-## Overview
-
-This page describes how the module of a Wemos D1 mini and ESP8266 is wired to the radio module and is flashed with the latest Firmware.
-Further information will help you to communicate to the compatible inverters.
-
-You find the full [User_Manual here](User_Manual.md)
-
-## Compatiblity
+Solenso Inverters:
-For now the following Inverters should work out of the box:
-
-Hoymiles Inverters
-
-- HM300
-- HM350
-- HM400
-- HM600
-- HM700
-- HM800
-- HM1000?
-- HM1200
-- HM1500
-
-TSun Inverters:
-
-- TSOL-350
-- TSOL-400
-- others may work as well (need to be verified).
+- SOL-H350
## Things needed
@@ -68,8 +64,9 @@ Make sure the NRF24L01+ module has the "+" in its name as we depend on the 250kb
| **Parts** | **Price** |
| --- | --- |
-| D1 ESP8266 Mini WLAN Board Mikrokontroller | 4,40 Euro |
+| D1 ESP8266 Mini WLAN Board Microcontroller | 4,40 Euro |
| NRF24L01+ SMD Modul 2,4 GHz Wi-Fi Funkmodul | 3,45 Euro |
+| 100µF / 10V Capacitor Kondensator | 0,15 Euro |
| Jumper Wire Steckbrücken Steckbrett weiblich-weiblich | 2,49 Euro |
| **Total costs** | **10,34 Euro** |
@@ -79,15 +76,28 @@ To also run our sister project OpenDTU and be upwards compatible for the future
| --- | --- |
| ESP32 Dev Board NodeMCU WROOM32 WiFi | 7,90 Euro |
| NRF24L01+ PA LNA SMA mit Antenne Long | 4,50 Euro |
+| 100µF / 10V Capacitor Kondensator | 0,15 Euro |
| Jumper Wire Steckbrücken Steckbrett weiblich-weiblich | 2,49 Euro |
| **Total costs** | **14,89 Euro** |
#### There are fake NRF24L01+ Modules out there
Watch out, there are some fake NRF24L01+ Modules out there that seem to use rebranded NRF24L01 Chips (without the +).
-An example can be found in [Issue #230](https://github.com/grindylow/ahoy/issues/230).
+An example can be found in [Issue #230](https://github.com/lumapu/ahoy/issues/230).
You are welcome to add more examples of faked chips. We will add that information here.
+Some users reported better connection or longer range through more walls when using the
+"E01-ML01DP5" EBYTE 2,4 GHz Wireless Modul nRF24L01 + PA + LNA RF Modul, SMA-K Antenna connector,
+which has an eye-catching HF cover. But beware: It comes without the antenna!
+
+In any case you should stabilize the Vcc power by a capacitor and don't exceed the Amplifier Power Level "LOW".
+Users reporting good connection over 10m through walls / ceilings with Amplifier Power Level "MIN".
+It is not always the bigger the better...
+
+Power levels "HIGH" and "MAX" are meant to wirings where the nRF24 is supplied by an extra 3.3 Volt regulator.
+The bultin regulator on ESP boards has only low reserves in case WiFi and nRF are sending simultaneously.
+If you operate additional interfaces like a display, the reserve is again reduced.
+
## Wiring things up
The NRF24L01+ radio module is connected to the standard SPI pins:
@@ -106,17 +116,29 @@ Additional, there are 3 pins, which can be set individual:
*These pins can be changed from the /setup URL.*
-#### ESP8266 wiring example
+#### ESP8266 wiring example on WEMOS D1
This is an example wiring using a Wemos D1 mini.
##### Schematic
-
+
##### Symbolic view
-
+
+
+#### ESP8266 wiring example on 30pin Lolin NodeMCU v3
+
+This is an example wiring using a NodeMCU V3.
+
+##### Schematic
+
+
+
+##### Symbolic view
+
+
#### ESP32 wiring example
@@ -124,11 +146,11 @@ Example wiring for a 38pin ESP32 module
##### Schematic
-
+
##### Symbolic view
-
+
##### ESP32 GPIO settings
@@ -140,12 +162,27 @@ CE D2 (GPIO4)
IRQ D0 (GPIO16 - no IRQ!)
```
+ATTENTION: From development version 108 onwards, also MISO, MOSI and SCLK
+are configurable. Their defaults are correct for 'standard' ESP32 boards
+and non-settable for ESP8266 (as this chip cannot move them elsewhere).
+If you have an existing install though, you might see '0' in the web GUI.
+
+Set MISO=19, MOSI=23, SCLK=18 in GUI and save for existing installs, this is the old
+correct default for most ESP32 boards, for ESP82xx, a simple settings save should suffice.
+Reboot afterwards.
+
+
## Flash the Firmware on your Ahoy DTU Hardware
Once your Hardware is ready to run, you need to flash the Ahoy DTU Firmware to your Board.
You can either build your own using your own configuration or use one of our pre-compiled generic builds.
-#### Compiling your own Version
+### Flash from your browser (easy)
+
+The easiest step for you is to flash online. A browser MS Edge or Google Chrome is required.
+[Here you go](https://ahoydtu.de/web_install/)
+
+### Compiling your own Version
This information suits you if you want to configure and build your own firmware.
@@ -204,7 +241,7 @@ When everything is wired up and the firmware is flashed, it is time to connect t
If nothing connects to it and that time runs up, it will retry to connect to the configured network an so on.
If connected to your local Network, you just have to find out the used IP Address or try the default name [http://ahoy-dtu/](http://ahoy-dtu/). In most cases your Router will give you a hint.
- If you connect to the WiFi the Ahoy DTU opens in case it could not connect to any other Network, the IP-Address of your Ahoy DTU is [http://192.168.1.1/](http://192.168.1.1/).
+ If you connect to the WiFi the Ahoy DTU opens in case it could not connect to any other Network, the IP-Address of your Ahoy DTU is [http://192.168.4.1/](http://192.168.4.1/).
Just open the IP-Address in your browser.
The webinterface has the following abilities:
@@ -216,25 +253,26 @@ When everything is wired up and the firmware is flashed, it is time to connect t
##### HTTP based Pages
- To take control of your Ahoy DTU, you can directly call one of the following sub-pages (e.g. [http://ahoy-dtu/setup](http://ahoy-dtu/setup) or [http://192.168.1.1/setup](http://192.168.1.1/setup) ).
-
-| page | use | output |
-| ---- | ------ | ------ |
-| /uptime | displays the uptime of your Ahoy DTU | 0 Days, 01:37:34; now: 2022-08-21 11:13:53 |
-| /reboot | reboots the Ahoy DTU | |
-| /erase | erases the EEPROM | |
-| /factory | resets to the factory defaults configured in config.h | |
-| /setup | opens the setup page | |
-| /save | | |
-| /cmdstat | show stat from the home page | |
-| /visualization | displays the information from your converter | |
-| /livedata | displays the live data | |
-| /json | gets live-data in JSON format | json output from the livedata |
-| /api | | |
+ To take control of your Ahoy DTU, you can directly call one of the following sub-pages (e.g. [http://ahoy-dtu/setup](http://ahoy-dtu/setup) or [http://192.168.4.1/setup](http://192.168.4.1/setup) ).
+
+| page | use | output | default availability |
+| ---- | ------ | ------ | ------ |
+| /uptime | displays the uptime uf your Ahoy DTU | 0 Days, 01:37:34; now: 2022-08-21 11:13:53 | yes |
+| /reboot | reboots the Ahoy DTU | | yes |
+| /erase | erases the EEPROM | | yes |
+| /factory | resets to the factory defaults configured in config.h | | yes |
+| /setup | opens the setup page | | yes |
+| /save | | | yes |
+| /cmdstat | show stat from the home page | | yes |
+| /visualization | displays the information from your converter | | yes |
+| /livedata | displays the live data | | yes |
+| /json | gets live-data in JSON format | json output from the livedata | no - enable via config_override.h |
+| /metrics | gets live-data for prometheus | prometheus metrics from the livedata | no - enable via config_override.h |
+| /api | | | yes |
## MQTT command to set the DTU without webinterface
-[Read here](tools/esp8266/User_Manual.md)
+[Read here](User_Manual.md)
## Used Libraries
@@ -251,12 +289,7 @@ When everything is wired up and the firmware is flashed, it is time to connect t
| `RF24` | 1.4.5 | GPL-2.0 |
| `PubSubClient` | 2.8 | MIT |
| `ArduinoJson` | 6.19.4 | MIT |
-
-## Contact
-
-We run a Discord Server that can be used to get in touch with the Developers and Users.
-
-
+| `ESP Async WebServer` | 4.3.0 | ? |
## ToDo
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..cbe5ad16
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,437 @@
+Attribution-NonCommercial-ShareAlike 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
+Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-NonCommercial-ShareAlike 4.0 International Public License
+("Public License"). To the extent this Public License may be
+interpreted as a contract, You are granted the Licensed Rights in
+consideration of Your acceptance of these terms and conditions, and the
+Licensor grants You such rights in consideration of benefits the
+Licensor receives from making the Licensed Material available under
+these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. BY-NC-SA Compatible License means a license listed at
+ creativecommons.org/compatiblelicenses, approved by Creative
+ Commons as essentially the equivalent of this Public License.
+
+ d. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ e. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ g. License Elements means the license attributes listed in the name
+ of a Creative Commons Public License. The License Elements of this
+ Public License are Attribution, NonCommercial, and ShareAlike.
+
+ h. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ i. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ j. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ k. NonCommercial means not primarily intended for or directed towards
+ commercial advantage or monetary compensation. For purposes of
+ this Public License, the exchange of the Licensed Material for
+ other material subject to Copyright and Similar Rights by digital
+ file-sharing or similar means is NonCommercial provided there is
+ no payment of monetary compensation in connection with the
+ exchange.
+
+ l. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ m. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ n. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part, for NonCommercial purposes only; and
+
+ b. produce, reproduce, and Share Adapted Material for
+ NonCommercial purposes only.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. Additional offer from the Licensor -- Adapted Material.
+ Every recipient of Adapted Material from You
+ automatically receives an offer from the Licensor to
+ exercise the Licensed Rights in the Adapted Material
+ under the conditions of the Adapter's License You apply.
+
+ c. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties, including when
+ the Licensed Material is used other than for NonCommercial
+ purposes.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ b. ShareAlike.
+
+ In addition to the conditions in Section 3(a), if You Share
+ Adapted Material You produce, the following conditions also apply.
+
+ 1. The Adapter's License You apply must be a Creative Commons
+ license with the same License Elements, this version or
+ later, or a BY-NC-SA Compatible License.
+
+ 2. You must include the text of, or the URI or hyperlink to, the
+ Adapter's License You apply. You may satisfy this condition
+ in any reasonable manner based on the medium, means, and
+ context in which You Share Adapted Material.
+
+ 3. You may not offer or impose any additional or different terms
+ or conditions on, or apply any Effective Technological
+ Measures to, Adapted Material that restrict exercise of the
+ rights granted under the Adapter's License You apply.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database for NonCommercial purposes
+ only;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material,
+ including for purposes of Section 3(b); and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/README.md b/README.md
index 45066d88..78094c78 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,45 @@
- 
+[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa] [![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].
+
+[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]
+
+[cc-by-nc-sa]: https://creativecommons.org/licenses/by-nc-sa/4.0/deed.de
+[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
+
+[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
+
# 🖐 Ahoy!

**Communicate with Hoymiles inverters via radio**. Get actual values like power, current, daily energy and set parameters like the power limit via web interface or MQTT. In this repository you will find different approaches means Hardware / Software to realize the described functionalities.
-List of approaches
+Table of approaches:
+
+| Board | MI | HM | HMS/HMT | comment | HowTo start |
+| ------ | -- | -- | ------- | ------- | ---------- |
+| [ESP8266/ESP32, C++](Getting_Started.md) | ✔️ | ✔️ | coming soon✨ | 👈 the most effort is spent here | [create your own DTU](https://ahoydtu.de/getting_started/) |
+| [Arduino Nano, C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | |
+| [Raspberry Pi, Python](tools/rpi/) | ❌ | ✔️ | ❌ | |
+| [Others, C/C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | |
-- [ESP8266/ESP32, C++](tools/esp8266/) 👈 the most effort is spent here
-- [Arduino Nano, C++](tools/nano/NRF24_SendRcv/)
-- [Raspberry Pi, Python](tools/rpi/)
-- [Others, C/C++](tools/nano/NRF24_SendRcv/)
+## Getting Started
+[Guide how to start with a ESP module](Getting_Started.md)
-## Quick Start with ESP8266
-- [Go here ✨](tools/esp8266/README.md#things-needed)
+[ESP Webinstaller (Edge / Chrome Browser only)](https://ahoydtu.de/web_install)
+## Our Website
+[https://ahoydtu.de](https://ahoydtu.de)
## Success Stories
- [Getting the data into influxDB and visualize them in a Grafana Dashboard](https://grafana.com/grafana/dashboards/16850-pv-power-ahoy/) (thx @Carl)
## Support, Feedback, Information and Discussion
-- [Discord Server (~ 300 Users)](https://discord.gg/WzhxEY62mB)
+- [Discord Server (~ 3.800 Users)](https://discord.gg/WzhxEY62mB)
- [The root of development](https://www.mikrocontroller.net/topic/525778)
### Development
@@ -32,4 +51,6 @@ Please try to describe your issues as precise as possible and think about if thi
### Related Projects
- [OpenDTU](https://github.com/tbnobody/OpenDTU)
-- [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles)
+ <- Our sister project ✨ for Hoymiles HM-300, HM-600, HM-1200 (for ESP32 only!)
+- [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles)
+ <- Go here ✨ for Hoymiles MI-300, MI-600, MI-1200 Software (single inverter only)
diff --git a/tools/esp8266/User_Manual.md b/User_Manual.md
similarity index 55%
rename from tools/esp8266/User_Manual.md
rename to User_Manual.md
index 1c882f48..242a2809 100644
--- a/tools/esp8266/User_Manual.md
+++ b/User_Manual.md
@@ -1,7 +1,7 @@
-# User Manual Ahoy DTU (on ESP8266)
+# User Manual AhoyDTU (on ESP8266)
Version #{VERSION}#
## Introduction
-See the repository [README.md](README.md)
+See the repository [README.md](Getting_Started.md)
## Setup
Assuming you have a running ahoy-dtu and you can access the setup page.
@@ -9,9 +9,51 @@ In the initial case or after click "erase settings" the fields for the inverter
Set at least the serial number and a name for each inverter, check "reboot after save" and click the "Save" button.
-## MQTT Output
-The ahoy dtu will publish on the following topics
-`//ch0/#`
+## MQTT Publish
+
+The AhoyDTU will publish on the following topics
+
+### `/#`
+
+| Topic | Example Value | Remarks | Retained |
+|---|---|---|---|
+| `comm_start` | 1672123767 | inverter communication start, based on sunrise, UTC timestamp | true |
+| `comm_stop` | 1672155709 | inverter communication stop, based on sunset, UTC timestamp | true |
+| `device` | AHOY-DTU | configured device name | true |
+| `dis_night_comm` | true | setting if night communication is disabled | true |
+| `free_heap` | 17784 | free heap of ESP in bytes | false |
+| `mqtt` | connected | shows MQTT status | true |
+| `status` | 1 | see table below | true |
+| `sunrise` | 1672124667 | sunrise, UTC timestamp | true |
+| `sunset` | 1672154809 | sunset, UTC timestamp | true |
+| `uptime` | 73630 | uptime in seconds | false |
+| `version` | 0.5.61 | current installed verison of AhoyDTU | true |
+| `wifi_rssi` | -75 | WiFi signal strength | false |
+| `ip_addr` | 192.168.178.25 | WiFi Station IP Address | true |
+
+| status code | Remarks |
+|---|---|
+| 0 | offline |
+| 1 | partial |
+| 2 | online |
+
+
+### `//#`
+
+| Topic | Example Value | Remarks | Retained |
+|---|---|---|---|
+| `available` | 2 | see table below | true |
+| `last_success` | 1672155690 | UTC Timestamp | true |
+| `ack_pwr_limit` | true | fast information if inverter has accepted power limit | false |
+
+| status code | Remarks |
+|---|---|
+| 0 | not available and not producing |
+| 1 | available but not producing |
+| 2 | available and producing |
+
+
+### `//ch0/#`
| Topic | Example Value | Remarks |
|---|---|---|
@@ -34,7 +76,7 @@ The ahoy dtu will publish on the following topics
|PowerLimit | 80.000|actual set point for power limit control AC active power in percent|
|LastAlarmCode | 1.000| Last Alarm Code eg. "inverter start"|
-`//ch/#`
+### `//ch/#`
`` is in the range 1 to 4 depending on the inverter type
@@ -47,10 +89,8 @@ The ahoy dtu will publish on the following topics
|YieldTotal | 110.819 | Energy converted to AC since reset Watt hours per module/channel (measured on DC) |
|Irradiation |5.65 | ratio DC Power over set maximum power per module/channel in percent |
-## Active Power Limit via Setup Page
-If you leave the field "Active Power Limit" empty during the setup and reboot the ahoy-dtu will set a value of 65535 in the setup.
-That is the value you have to fill in case you want to operate the inverter without a active power limit.
-If the value is 65535 or -1 after another reboot the value will be set automatically to "100" and in the drop-down menu "relative in percent persistent" will be set. Of course you can do this also by your self.
+## Active Power Limit via Serial / Control Page
+URL: `/serial`
You can change the setting in the following manner.
Decide if you want to set
@@ -68,160 +108,160 @@ after a power cycle of the inverter (P_DC=0 and P_AC=0 for at least 10 seconds)
The user has to ensure correct settings. Remember that for the inverters of 3rd generation the relative active power limit is in the range of 2% up to 100%.
Also an absolute active power limit below approx. 30 Watt seems to be not meanful because of the control capabilities and reactive power load.
-## Active Power Limit via MQTT
-The ahoy-dtu subscribes on the topic `/devcontrol/#` if the mqtt broker is set-up correctly. The default topic is `inverter/devcontrol/#`.
+## Control via MQTT
+
+### Generic Information
-To set the active power limit (controled value is the AC Power of the inverter) you have four options. (Only single phase inverters are actually in focus).
+The AhoyDTU subscribes on following topics:
-| topic | payload | active power limit in | Condition |
-| --------------------------------------------------------------- | ----------- | -------------------------------------------- | -------------- |
-| /devcontrol//11 OR /devcontrol//11/0 | [0..65535] | Watt | not persistent |
-| /devcontrol//11/256 | [0..65535] | Watt | persistent |
-| /devcontrol//11/1 | [2..100] | % | not persistent |
-| /devcontrol//11/257 | [2..100] | % | persistent |
+- `/ctrl/limit/`
+- `/ctrl/restart/`
+- `/setup/set_time`
+
+👆 `` can be set on setup page, default is `inverter`.
👆 `` is the number of the specific inverter in the setup page.
-* First inverter --> `` = 0
-* Second inverter --> `` = 1
-* ...
-
-### Developer Information MQTT Interface
-`/devcontrol///`
-
-The implementation allows to set any of the available `` Commands:
-```C
-typedef enum {
- TurnOn = 0, // 0x00
- TurnOff = 1, // 0x01
- Restart = 2, // 0x02
- Lock = 3, // 0x03
- Unlock = 4, // 0x04
- ActivePowerContr = 11, // 0x0b
- ReactivePowerContr = 12, // 0x0c
- PFSet = 13, // 0x0d
- CleanState_LockAndAlarm = 20, // 0x14
- SelfInspection = 40, // 0x28, self-inspection of grid-connected protection files
- Init = 0xff
-} DevControlCmdType;
+
+### Inverter restart
+```mqtt
+/ctrl/restart/
```
-The MQTT payload will be set on first to bytes and ``, which is taken from the topic path will be set on the second two bytes if the corresponding DevControlCmdType supports 4 byte data.
-See here the actual implementation to set the send buffer bytes.
-```C
-void sendControlPacket(uint64_t invId, uint8_t cmd, uint16_t *data) {
- sendCmdPacket(invId, TX_REQ_DEVCONTROL, ALL_FRAMES, false);
- int cnt = 0;
- // cmd --> 0x0b => Type_ActivePowerContr, 0 on, 1 off, 2 restart, 12 reactive power, 13 power factor
- mTxBuf[10] = cmd;
- mTxBuf[10 + (++cnt)] = 0x00;
- if (cmd >= ActivePowerContr && cmd <= PFSet){
- mTxBuf[10 + (++cnt)] = ((data[0] * 10) >> 8) & 0xff; // power limit || high byte from MQTT payload
- mTxBuf[10 + (++cnt)] = ((data[0] * 10) ) & 0xff; // power limit || low byte from MQTT payload
- mTxBuf[10 + (++cnt)] = ((data[1] ) >> 8) & 0xff; // high byte from MQTT topic value
- mTxBuf[10 + (++cnt)] = ((data[1] ) ) & 0xff; // low byte from MQTT topic value
- }
- // crc control data
- uint16_t crc = Hoymiles::crc16(&mTxBuf[10], cnt+1);
- mTxBuf[10 + (++cnt)] = (crc >> 8) & 0xff;
- mTxBuf[10 + (++cnt)] = (crc ) & 0xff;
- // crc over all
- cnt +=1;
- mTxBuf[10 + cnt] = Hoymiles::crc8(mTxBuf, 10 + cnt);
-
- sendPacket(invId, mTxBuf, 10 + (++cnt), true);
-}
+Example:
+```mqtt
+inverter/ctrl/restart/0
+```
+
+### Power Limit relative (non persistent) [%]
+
+```mqtt
+/ctrl/limit/
```
+with a payload `[2 .. 100]`
-So as example sending any payload on `inverter/devcontrol/0/1` will switch off the inverter.
+**NOTE: optional a `%` can be sent as last character**
+
+Example:
+```mqtt
+inverter/ctrl/limit/0 70
+```
+
+### Power Limit absolute (non persistent) [Watts]
+```mqtt
+/ctrl/limit/
+```
+with a payload `[0 .. 65535]`
+
+**NOTE: the unit `W` is necessary to determine an absolute limit**
+
+Example:
+```mqtt
+inverter/ctrl/limit/0 600W
+```
+
+### Power Limit persistent
+This feature was removed. The persisten limit should not be modified cyclic by a script because of potential wearout of the flash inside the inverter.
+
+## Control via REST API
+
+### Generic Information
+
+The rest API works with *JSON* POST requests. All the following instructions must be sent to the `/api` endpoint of the AhoyDTU.
+
+👆 `` is the number of the specific inverter in the setup page.
+
+### Inverter Power (On / Off)
-## Active Power Limit via REST API
-It is also implemented to set the power limit via REST API call. Therefore send a POST request to the endpoint /api.
-The response will always be a json with {success:true}
-The payload shall be a json formated string in the following manner
```json
{
- "inverter":,
- "tx_request": ,
- "cmd": ,
- "payload": ,
- "payload2":
+ "id": ,
+ "cmd": "power",
+ "val":
}
```
-With the following value ranges
+The `` should be set to `1` = `ON` and `0` = `OFF`
-| Value | range | note |
-| --------------------------- | ----------- | ------------------------------- |
-| | 81 or 21 | integer uint8, (0x15 or 0x51) |
-| | [0...255] | integer uint8, subcmds eg. 0x0b |
-| | [0...65535] | uint16 |
-| | [0...3] | integer uint8 |
+### Inverter restart
-Example to set the active power limit non persistent to 10%
```json
{
- "inverter":0,
- "tx_request": 81,
- "cmd": 11,
- "payload": 10,
- "payload2": 1
+ "id": ,
+ "cmd": "restart"
}
```
-Example to set the active power limit persistent to 600Watt
+
+
+### Power Limit relative persistent [%]
+
```json
{
- "inverter":0,
- "tx_request": 81,
- "cmd": 11,
- "payload": 600,
- "payload2": 256
+ "id": ,
+ "cmd": "limit_persistent_relative",
+ "val":
}
```
+The `VALUE` represents a percent number in a range of `[2 .. 100]`
+
+
+### Power Limit absolute persistent [Watts]
-### Developer Information REST API
-In the same approach as for MQTT any other SubCmd and also MainCmd can be applied and the response payload can be observed in the serial logs. Eg. request the Alarm-Data from the Alarm-Index 5 from inverter 0 will look like this:
```json
{
- "inverter":0,
- "tx_request": 21,
- "cmd": 17,
- "payload": 5,
- "payload2": 0
+ "id": ,
+ "cmd": "limit_persistent_absolute",
+ "val":
}
```
+The `VALUE` represents watts in a range of `[0 .. 65535]`
-## Zero Export Control
-* You can use the mqtt topic `/devcontrol//11` with a number as payload (eg. 300 -> 300 Watt) to set the power limit to the published number in Watt. (In regular cases the inverter will use the new set point within one intervall period; to verify this see next bullet)
-* You can check the inverter set point for the power limit control on the topic `//ch0/PowerLimit` 👆 This value is ALWAYS in percent of the maximum power limit of the inverter. In regular cases this value will be updated within approx. 15 seconds. (depends on request intervall)
-* You can monitor the actual AC power by subscribing to the topic `//ch0/P_AC` 👆 This value is ALWAYS in Watt
-## Issues and Debuging for active power limit settings
+### Power Limit relative non persistent [%]
-Turn on the serial debugging in the setup. Try to have find out if the behavior is deterministic. That means can you reproduce the behavior. Be patient and wait on inverter reactions at least some minutes and beware that the DC-Power is sufficient.
+```json
+{
+ "id": ,
+ "cmd": "limit_nonpersistent_relative",
+ "val":
+}
+```
+The `VALUE` represents a percent number in a range of `[2 .. 100]`
-In case of issues please report:
-1. Version of firmware
-2. The output of the serial debug esp. the TX messages starting with "0x51" and the RX messages starting with "0xD1" or "0xF1"
-3. Which case you have tried: Setup-Page, MQTT, REST API and at what was shown on the "Visualization Page" at the Location "Limit"
-4. The setting means payload, relative, absolute, persistent, not persistent (see tables above)
+### Power Limit absolute non persistent [Watts]
+
+```json
+{
+ "id": ,
+ "cmd": "limit_nonpersistent_absolute",
+ "val":
+}
+```
+The `VALUE` represents watts in a range of `[0 .. 65535]`
-**Developer Information General for Active Power Limit**
-⚡The following was verified by field tests and feedback from users
-Internally this values will be set for the second two bytes for MainCmd: 0x51 SubCmd: 0x0b --> DevControl set ActivePowerLimit
-```C
-typedef enum {
- AbsolutNonPersistent = 0x0000, // 0
- RelativNonPersistent = 0x0001, // 1
- AbsolutPersistent = 0x0100, // 256
- RelativPersistent = 0x0101 // 257
-} PowerLimitControlType;
+### Developer Information REST API (obsolete)
+In the same approach as for MQTT any other SubCmd and also MainCmd can be applied and the response payload can be observed in the serial logs. Eg. request the Alarm-Data from the Alarm-Index 5 from inverter 0 will look like this:
+```json
+{
+ "inverter":0,
+ "tx_request": 21,
+ "cmd": 17,
+ "payload": 5,
+ "payload2": 0
+}
```
+## Zero Export Control (needs rework)
+* You can use the mqtt topic `/devcontrol//11` with a number as payload (eg. 300 -> 300 Watt) to set the power limit to the published number in Watt. (In regular cases the inverter will use the new set point within one intervall period; to verify this see next bullet)
+* You can check the inverter set point for the power limit control on the topic `//ch0/PowerLimit` 👆 This value is ALWAYS in percent of the maximum power limit of the inverter. In regular cases this value will be updated within approx. 15 seconds. (depends on request intervall)
+* You can monitor the actual AC power by subscribing to the topic `//ch0/P_AC` 👆 This value is ALWAYS in Watt
+
+
## Firmware Version collection
Gather user inverter information here to understand what differs between some inverters.
+To get the information open the URL `/api/record/info` on your AhoyDTU. The information will only be present once the AhoyDTU was able to communicate with an inverter.
| Name | Inverter Typ | Bootloader V. | FWVersion | FWBuild [YYYY] | FWBuild [MM-DD] | HWPartId | | |
| ---------- | ------------ | ------------- | --------- | -------------- | --------------- | --------- | -------- | --------- |
@@ -241,7 +281,12 @@ Gather user inverter information here to understand what differs between some in
| chehrlic | HM-600 | | 1.0.10 | 2021 | 11-01 | 104 | | |
| chehrlic | TSOL-M800de | | 1.0.10 | 2021 | 11-01 | 104 | | |
| B5r1oJ0A9G | HM-800 | | 1.0.10 | 2021 | | 104 | | |
-| | | | | | | | | |
+| B5r1oJ0A9G | HM-800 | | 1.0.10 | 2021 | | 104 | | |
+| tomquist | TSOL-M1600 | | 1.0.12 | 2020 | 06-24 | 100 | | |
+| rejoe2 | MI-600 | | 236 | 2018 | 11-27 | 17 | | |
+| rejoe2 | MI-1500 | | 1.0.12 | 2020 | 06-24 | 100 | | |
+| dragricola | HM-1200 | | 1.0.16 | 2021 | 10-12 | 100 | | |
+| dragricola | MI-300 | | 230 | 2017 | 08-08 | 1 | | |
| | | | | | | | | |
## Developer Information about Command Queue
@@ -276,3 +321,11 @@ Send Power Limit:
- A persistent limit is only needed if you want to throttle your inverter permanently or you can use it to set a start value on the battery, which is then always the switch-on limit when switching on, otherwise it would ramp up to 100% without regulation, which is continuous load is not healthy.
- You can set a new limit in the turn-off state, which is then used for on (switching on again), otherwise the last limit from before the turn-off is used, but of course this only applies if DC voltage is applied the whole time.
- If the DC voltage is missing for a few seconds, the microcontroller in the inverter goes off and forgets everything that was temporary/non-persistent in the RAM: YieldDay, error memory, non-persistent limit.
+
+## Additional Notes
+### MI Inverters
+- AhoyDTU supports MI type inverters as well, since dev. version 0.5.70.
+- MI inverters are known to be delivered with two different generations of firmwares: inverters with serial numbers 10x2 already use the 3rd generation protocol and behave just like the newer HM models, *the follwoing remarks do not apply to these*.
+- Older MI inverters (#sn 10x1) use a different rf protocol and thus do not deliver exactly the same data. E.g. the AC power value will therefore be calculated by AhoyDTU itself, while other values might not be available at all.
+- Single and dual channel 2nd gen. devices seem not to accept power limiting commands at all, the lower limit for 4-channel MI is 10% (instead of 2% for newer models)
+- 4-channel MI type inverters might work, but code still is untested.
diff --git a/doc/ESP8266_nRF24L01+_LolinNodeMCUv3.png b/doc/ESP8266_nRF24L01+_LolinNodeMCUv3.png
new file mode 100644
index 00000000..2b37a3b0
Binary files /dev/null and b/doc/ESP8266_nRF24L01+_LolinNodeMCUv3.png differ
diff --git a/doc/ESP8266_nRF24L01+_Schaltplan.jpg b/doc/ESP8266_nRF24L01+_Schaltplan.jpg
new file mode 100644
index 00000000..749e3fa3
Binary files /dev/null and b/doc/ESP8266_nRF24L01+_Schaltplan.jpg differ
diff --git a/doc/prometheus_ep_description.md b/doc/prometheus_ep_description.md
new file mode 100644
index 00000000..8fb9e002
--- /dev/null
+++ b/doc/prometheus_ep_description.md
@@ -0,0 +1,51 @@
+# Prometheus Endpoint
+Metrics available for AhoyDTU device, inverters and channels.
+
+Prometheus metrics provided at `/metrics`.
+
+## Labels
+| Label name | Description |
+|:-------------|:--------------------------------------|
+| version | current installed version of AhoyDTU |
+| image | currently not used |
+| devicename | Device name from setup |
+| name | Inverter name from setup |
+| serial | Serial number of inverter |
+| inverter | Inverter name from setup |
+| channel | Channel name from setup |
+
+## Exported Metrics
+| Metric name | Type | Description | Labels |
+|----------------------------------------|---------|--------------------------------------------------------|--------------|
+| `ahoy_solar_info` | Gauge | Information about the AhoyDTU device | version, image, devicename |
+| `ahoy_solar_uptime` | Counter | Seconds since boot of the AhoyDTU device | devicename |
+| `ahoy_solar_rssi_db` | Gauge | Quality of the Wifi STA connection | devicename |
+| `ahoy_solar_inverter_info` | Gauge | Information about the configured inverter(s) | name, serial |
+| `ahoy_solar_inverter_enabled` | Gauge | Is the inverter enabled? | inverter |
+| `ahoy_solar_inverter_is_available` | Gauge | is the inverter available? | inverter |
+| `ahoy_solar_inverter_is_producing` | Gauge | Is the inverter producing? | inverter |
+| `ahoy_solar_U_AC_volt` | Gauge | AC voltage of inverter [V] | inverter |
+| `ahoy_solar_I_AC_ampere` | Gauge | AC current of inverter [A] | inverter |
+| `ahoy_solar_P_AC_watt` | Gauge | AC power of inverter [W] | inverter |
+| `ahoy_solar_Q_AC_var` | Gauge | AC reactive power[var] | inverter |
+| `ahoy_solar_F_AC_hertz` | Gauge | AC frequency [Hz] | inverter |
+| `ahoy_solar_PF_AC` | Gauge | AC Power factor | inverter |
+| `ahoy_solar_Temp_celsius` | Gauge | Temperature of inverter | inverter |
+| `ahoy_solar_ALARM_MES_ID` | Gauge | Alarm message index of inverter | inverter |
+| `ahoy_solar_LastAlarmCode` | Gauge | Last alarm code from inverter | inverter |
+| `ahoy_solar_YieldDay_wattHours` | Counter | Energy converted to AC per day [Wh] | inverter |
+| `ahoy_solar_YieldTotal_kilowattHours` | Counter | Energy converted to AC since reset [kWh] | inverter |
+| `ahoy_solar_P_DC_watt` | Gauge | DC power of inverter [W] | inverter |
+| `ahoy_solar_Efficiency_ratio` | Gauge | ration AC Power over DC Power [%] | inverter |
+| `ahoy_solar_U_DC_volt` | Gauge | DC voltage of channel [V] | inverter, channel |
+| `ahoy_solar_I_DC_ampere` | Gauge | DC current of channel [A] | inverter, channel |
+| `ahoy_solar_P_DC_watt` | Gauge | DC power of channel [P] | inverter, channel |
+| `ahoy_solar_YieldDay_wattHours` | Counter | Energy converted to AC per day [Wh] | inverter, channel |
+| `ahoy_solar_YieldTotal_kilowattHours` | Counter | Energy converted to AC since reset [kWh] | inverter, channel |
+| `ahoy_solar_Irradiation_ratio` | Gauge | ratio DC Power over set maximum power per channel [%] | inverter, channel |
+| `ahoy_solar_radio_rx_success` | Gauge | NRF24 statistic | |
+| `ahoy_solar_radio_rx_fail` | Gauge | NRF24 statistic | |
+| `ahoy_solar_radio_rx_fail_answer` | Gauge | NRF24 statistic | |
+| `ahoy_solar_radio_frame_cnt` | Gauge | NRF24 statistic | |
+| `ahoy_solar_radio_tx_cnt` | Gauge | NRF24 statistic | |
+
diff --git a/tools/esp8266/scripts/auto_firmware_version.py b/scripts/auto_firmware_version.py
similarity index 88%
rename from tools/esp8266/scripts/auto_firmware_version.py
rename to scripts/auto_firmware_version.py
index a9c74371..c4ab270d 100644
--- a/tools/esp8266/scripts/auto_firmware_version.py
+++ b/scripts/auto_firmware_version.py
@@ -17,7 +17,7 @@ from dulwich import porcelain
def get_firmware_specifier_build_flag():
try:
- build_version = porcelain.describe('../../') # refers to the repository root dir
+ build_version = porcelain.describe('../') # refers to the repository root dir
except:
build_version = "g0000000"
diff --git a/scripts/buildManifest.py b/scripts/buildManifest.py
new file mode 100644
index 00000000..db29b352
--- /dev/null
+++ b/scripts/buildManifest.py
@@ -0,0 +1,55 @@
+import os
+from datetime import date
+import json
+
+def readVersion(path, infile):
+ f = open(path + infile, "r")
+ lines = f.readlines()
+ f.close()
+
+ today = date.today()
+ search = ["_MAJOR", "_MINOR", "_PATCH"]
+ version = today.strftime("%y%m%d") + "_ahoy_"
+ versionnumber = ""# "ahoy_v"
+ for line in lines:
+ if(line.find("VERSION_") != -1):
+ for s in search:
+ p = line.find(s)
+ if(p != -1):
+ version += line[p+13:].rstrip() + "."
+ versionnumber += line[p+13:].rstrip() + "."
+
+ return [versionnumber[:-1], version[:-1]]
+
+def buildManifest(path, infile, outfile):
+ version = readVersion(path, infile)
+ sha = os.getenv("SHA",default="sha")
+ data = {}
+ data["name"] = "AhoyDTU - Development"
+ data["version"] = version[0]
+ data["new_install_prompt_erase"] = 1
+ data["builds"] = []
+
+ esp32 = {}
+ esp32["chipFamily"] = "ESP32"
+ esp32["parts"] = []
+ esp32["parts"].append({"path": "bootloader.bin", "offset": 4096})
+ esp32["parts"].append({"path": "partitions.bin", "offset": 32768})
+ esp32["parts"].append({"path": "ota.bin", "offset": 57344})
+ esp32["parts"].append({"path": version[1] + "_" + sha + "_esp32.bin", "offset": 65536})
+ data["builds"].append(esp32)
+
+ esp8266 = {}
+ esp8266["chipFamily"] = "ESP8266"
+ esp8266["parts"] = []
+ esp8266["parts"].append({"path": version[1] + "_" + sha + "_esp8266.bin", "offset": 0})
+ data["builds"].append(esp8266)
+
+ jsonString = json.dumps(data, indent=2)
+
+ fp = open(path + "firmware/" + outfile, "w")
+ fp.write(jsonString)
+ fp.close()
+
+
+buildManifest("", "defines.h", "manifest.json")
diff --git a/scripts/getVersion.py b/scripts/getVersion.py
new file mode 100644
index 00000000..0ebe1ec2
--- /dev/null
+++ b/scripts/getVersion.py
@@ -0,0 +1,97 @@
+import os
+import shutil
+import gzip
+from datetime import date
+
+def genOtaBin(path):
+ arr = []
+ arr.append(1)
+ arr.append(0)
+ arr.append(0)
+ arr.append(0)
+ for x in range(24):
+ arr.append(255)
+ arr.append(154)
+ arr.append(152)
+ arr.append(67)
+ arr.append(71)
+ for x in range(4064):
+ arr.append(255)
+ arr.append(0)
+ arr.append(0)
+ arr.append(0)
+ arr.append(0)
+ for x in range(4092):
+ arr.append(255)
+ with open(path + "ota.bin", "wb") as f:
+ f.write(bytearray(arr))
+
+# write gzip firmware file
+def gzip_bin(bin_file, gzip_file):
+ with open(bin_file,"rb") as fp:
+ with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
+ shutil.copyfileobj(fp, f)
+
+def readVersion(path, infile):
+ f = open(path + infile, "r")
+ lines = f.readlines()
+ f.close()
+
+ today = date.today()
+ search = ["_MAJOR", "_MINOR", "_PATCH"]
+ version = today.strftime("%y%m%d") + "_ahoy_"
+ versionnumber = "ahoy_v"
+ for line in lines:
+ if(line.find("VERSION_") != -1):
+ for s in search:
+ p = line.find(s)
+ if(p != -1):
+ version += line[p+13:].rstrip() + "."
+ versionnumber += line[p+13:].rstrip() + "."
+
+ os.mkdir(path + "firmware/")
+ sha = os.getenv("SHA",default="sha")
+
+ versionout = version[:-1] + "_" + sha + "_esp8266.bin"
+ src = path + ".pio/build/esp8266-release/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+
+ versionout = version[:-1] + "_" + sha + "_esp8266_prometheus.bin"
+ src = path + ".pio/build/esp8266-release-prometheus/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+
+ versionout = version[:-1] + "_" + sha + "_esp8285.bin"
+ src = path + ".pio/build/esp8285-release/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+ gzip_bin(dst, dst + ".gz")
+
+ versionout = version[:-1] + "_" + sha + "_esp32.bin"
+ src = path + ".pio/build/esp32-wroom32-release/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+
+ versionout = version[:-1] + "_" + sha + "_esp32_prometheus.bin"
+ src = path + ".pio/build/esp32-wroom32-release-prometheus/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+
+ versionout = version[:-1] + "_" + sha + "_esp32s3.bin"
+ src = path + ".pio/build/opendtufusionv1-release/firmware.bin"
+ dst = path + "firmware/" + versionout
+ os.rename(src, dst)
+
+ # other ESP32 bin files
+ src = path + ".pio/build/esp32-wroom32-release/"
+ dst = path + "firmware/"
+ os.rename(src + "bootloader.bin", dst + "bootloader.bin")
+ os.rename(src + "partitions.bin", dst + "partitions.bin")
+ genOtaBin(path + "firmware/")
+ os.rename("../scripts/gh-action-dev-build-flash.html", path + "install.html")
+
+ print("name=" + versionnumber[:-1] )
+
+
+readVersion("", "defines.h")
diff --git a/scripts/gh-action-dev-build-flash.html b/scripts/gh-action-dev-build-flash.html
new file mode 100644
index 00000000..ea6146db
--- /dev/null
+++ b/scripts/gh-action-dev-build-flash.html
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+ Flash | AhoyDTU
+
+
+
+ Hierzu die Ahoy-Hardware per USB Kabel an den PC stecken und evtl. warten, bis die Treiber installiert sind. Anschließend auf den ensprechenden connect Button klicken.
+
+
+
+
+
+
+ Your browser does not support installing things on ESP devices. Use Google Chrome or Microsoft Edge.
+