From 5e2ea9effa0b84475a62a8111a59be994c71588b Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Thu, 8 Sep 2022 15:20:22 +0200 Subject: [PATCH 1/6] Update README.md --- README.md | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9768fc31..697a6801 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,35 @@ ![actions/workflows/compile_esp8266.yml](../../actions/workflows/compile_esp8266.yml/badge.svg) ![actions/workflows/compile_development.yml](../../actions/workflows/compile_development.yml/badge.svg) +# πŸ– Ahoy! ![Logo](https://github.com/grindylow/ahoy/blob/main/doc/logo1_small.png?raw=true) -# ahoy -Ahoy is a project to bypass the original Hoymiles cloud solution. -In order to use this project, it is important what the area of ​​​​application looks like. -With each version it is necessary to have an NRF24L01+. +**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. -Click on the link below you are interested in. -There you will find further explanations on how to proceed. (*Note: It is still under construction!*) +List of approaches -##### Most updated section -- [ESP8266](tools/esp8266/) that includes an web interface +- [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/) -##### will be updated as needed -- [Arduino Nano](tools/nano/NRF24_SendRcv/) -- [Raspberry Pi](tools/rpi/) -- [others](tools/nano/NRF24_SendRcv/) +## Quick Start with ESP8266 +- [Go here ✨](https://github.com/grindylow/ahoy/blob/ahoy_v0.5.16/tools/esp8266/README.md#things-needed) -If errors occur or you have suggestions for ideas, please feel free to contact us [here](https://github.com/grindylow/ahoy/issues). -## Contact -We run a Discord Server that can be used to get in touch with the Developers and Users. +## 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) -https://discord.gg/WzhxEY62mB +## Support, Feedback, Information and Discussion +- [Discord Server (~ 300 Users)](https://discord.gg/WzhxEY62mB) +- [The root of development](https://www.mikrocontroller.net/topic/525778) + +### Development +If you encounter issues use the issues here on github. + +Please try to describe your issues as precise as possible and think about if this is a issue with the software here in the repository or other software components. **Contributors are always welcome!** + +### Related Projects +- [OpenDTU](https://github.com/tbnobody/OpenDTU) +- [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles) From e0b5b471ca8826e8102705b239b2fbdfe4dc110a Mon Sep 17 00:00:00 2001 From: Martin Dummer Date: Fri, 9 Sep 2022 08:51:55 +0200 Subject: [PATCH 2/6] README.md: fix links fix links from absolute to relative paths where applicable Signed-off-by: Martin Dummer --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 697a6801..f9fd338f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![actions/workflows/compile_esp8266.yml](../../actions/workflows/compile_esp8266.yml/badge.svg) ![actions/workflows/compile_development.yml](../../actions/workflows/compile_development.yml/badge.svg) # πŸ– Ahoy! -![Logo](https://github.com/grindylow/ahoy/blob/main/doc/logo1_small.png?raw=true) +![Logo](doc/logo1_small.png?raw=true) **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. @@ -13,7 +13,7 @@ List of approaches - [Others, C/C++](tools/nano/NRF24_SendRcv/) ## Quick Start with ESP8266 -- [Go here ✨](https://github.com/grindylow/ahoy/blob/ahoy_v0.5.16/tools/esp8266/README.md#things-needed) +- [Go here ✨](tools/esp8266/README.md#things-needed) ## Success Stories From e49350b73f40e2fb2a9c14c88a52ee18d5770658 Mon Sep 17 00:00:00 2001 From: Martin Dummer Date: Fri, 9 Sep 2022 10:16:41 +0200 Subject: [PATCH 3/6] User_Manual.md: add my inverter hw data Signed-off-by: Martin Dummer --- tools/esp8266/User_Manual.md | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/esp8266/User_Manual.md b/tools/esp8266/User_Manual.md index 774de905..7b0f4135 100644 --- a/tools/esp8266/User_Manual.md +++ b/tools/esp8266/User_Manual.md @@ -228,6 +228,7 @@ Gather user inverter information here to understand what differs between some in | tfhcm | TSUN-350 | | 1.0.14 | 2021 | 12-09 | 102 | | | | Groobi | TSOL-M400 | | 1.0.14 | 2021 | 12-09 | 102 | | | | setje | HM-600 | | 1.0.08 | 2020 | 07-10 | 104 | | | +| madmartin | HM-600 | 0.1.4 | 1.0.10 | 2021 | 11-01 | 104 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From cdb750081ae66fdbb08a2b266f87d0739e9eaa79 Mon Sep 17 00:00:00 2001 From: Martin Dummer Date: Thu, 8 Sep 2022 19:01:11 +0200 Subject: [PATCH 4/6] tools/esp8266/User_Manual.md: cleanup - fix markdown syntax to make github _and_ markdown editors happy - fix links from absolute to relative - remove trailing whitespace - fix some indentation Signed-off-by: Martin Dummer --- tools/esp8266/User_Manual.md | 116 +++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 54 deletions(-) diff --git a/tools/esp8266/User_Manual.md b/tools/esp8266/User_Manual.md index 774de905..63270f9c 100644 --- a/tools/esp8266/User_Manual.md +++ b/tools/esp8266/User_Manual.md @@ -1,17 +1,18 @@ # User Manual Ahoy DTU (on ESP8266) Version #{VERSION}# ## Introduction -See the repository [here](https://github.com/grindylow/ahoy/blob/main/tools/esp8266/README.md) +See the repository [README.md](README.md) ## Setup Assuming you have a running ahoy-dtu and you can access the setup page. In the initial case or after click "erase settings" the fields for the inverter setup are empty. -Set at least the serial number and a name for each inverter, check the "reboot after save" and click the "Save" button. +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/#`` +`//ch0/#` + | Topic | Example Value | Remarks | |---|---|---| |U_AC | 233.300|actual AC Voltage in Volt| @@ -33,9 +34,10 @@ 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 -```` is in the range 1 to 4 depending on the inverter type | Topic | Example Value | Remarks | |---|---|---| |U_DC | 38.900| actual DC Voltage in Volt| @@ -43,7 +45,7 @@ The ahoy dtu will publish on the following topics |P_DC | 25.000 | actual DC power in Watt| |YieldDay | 17.000 | Energy converted to AC per day Watt hours per module/channel (measured on DC) | |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 | +|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. @@ -52,41 +54,44 @@ If the value is 65535 or -1 after another reboot the value will be set automatic You can change the setting in the following manner. Decide if you want to set + - an absolute value in Watt - an relative value in percent based on the maximum Power capabilities of the inverter + and if this settings shall be + - persistent - not persistent + 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/#``. +The ahoy-dtu subscribes on the topic `/devcontrol/#` if the mqtt broker is set-up correctly. The default topic is `inverter/devcontrol/#`. 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). - | 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 +| /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 | -πŸ‘† ```` is the number of the specific inverter in the setup page. +πŸ‘† `` is the number of the specific inverter in the setup page. -* First inverter --> ```` = 0 -* Second inverter --> ```` = 1 +* First inverter --> `` = 0 +* Second inverter --> `` = 1 * ... ### Developer Information MQTT Interface -``/devcontrol///`` +`/devcontrol///` -The implementation allows to set any of the available ```` Commands: +The implementation allows to set any of the available `` Commands: ```C - typedef enum { +typedef enum { TurnOn = 0, // 0x00 TurnOff = 1, // 0x01 Restart = 2, // 0x02 @@ -100,34 +105,34 @@ The implementation allows to set any of the available ```` Co Init = 0xff } DevControlCmdType; ``` -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. +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); - } +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); +} ``` -So as example sending any payload on ``inverter/devcontrol/0/1`` will switch off the inverter. +So as example sending any payload on `inverter/devcontrol/0/1` will switch off the inverter. ## 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. @@ -186,19 +191,21 @@ In the same approach as for MQTT any other SubCmd and also MainCmd can be applie ``` ## 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 +* 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 + 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. + 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) - **Developer Information General for Active Power Limit** ⚑The following was verified by field tests and feedback from users @@ -212,7 +219,7 @@ typedef enum { RelativPersistent = 0x0101 // 257 } PowerLimitControlType; ``` - + ## Firmware Version collection Gather user inverter information here to understand what differs between some inverters. @@ -234,15 +241,16 @@ Gather user inverter information here to understand what differs between some in ## Developer Information about Command Queue After reboot or startup the ahoy firmware it will enque three commands in the following sequence: -1. Get active power limit in percent ( ```SystemConfigPara = 5 // 0x05```) -2. Get firmware version (```InverterDevInform_All = 1 // 0x01```) -3. Get data (```RealTimeRunData_Debug = 11 // 0x0b```) -With the command get data (```RealTimeRunData_Debug = 11 // 0x0b```) the alarm message counter will be updated. In the initial case then aonther command is queued to get the alarm code (``` AlarmData = 17 // 0x11```). +1. Get active power limit in percent (`SystemConfigPara = 5 // 0x05`) +2. Get firmware version (`InverterDevInform_All = 1 // 0x01`) +3. Get data (`RealTimeRunData_Debug = 11 // 0x0b`) + +With the command get data (`RealTimeRunData_Debug = 11 // 0x0b`) the alarm message counter will be updated. In the initial case then aonther command is queued to get the alarm code (`AlarmData = 17 // 0x11`). -This command (``` AlarmData = 17 // 0x11```) will enqued in any operation phase if alarm message counter is raised by one or greater compared to the last request with command get data (```RealTimeRunData_Debug = 11 // 0x0b```) +This command (`AlarmData = 17 // 0x11`) will enqued in any operation phase if alarm message counter is raised by one or greater compared to the last request with command get data (`RealTimeRunData_Debug = 11 // 0x0b`) -In case all commands are processed (```_commandQueue.empty() == true```) then as a default command the get data (```RealTimeRunData_Debug = 11 // 0x0b```) will be enqueued. +In case all commands are processed (`_commandQueue.empty() == true`) then as a default command the get data (`RealTimeRunData_Debug = 11 // 0x0b`) will be enqueued. In case a Device Control command (Power Limit, Off, On) is requested via MQTT or REST API this request will be send before any other enqueued command. -In case of a accepted change in power limit the command get active power limit in percent ( ```SystemConfigPara = 5 // 0x05```) will be enqueued. The acceptance is checked by the reponse packets on the devive control commands (tx id 0x51 --> rx id 0xD1) if in byte 12 the requested sub-command (eg. power limit) is present. +In case of a accepted change in power limit the command get active power limit in percent (`SystemConfigPara = 5 // 0x05`) will be enqueued. The acceptance is checked by the reponse packets on the devive control commands (tx id 0x51 --> rx id 0xD1) if in byte 12 the requested sub-command (eg. power limit) is present. From 20054ac9a6873059f198f181f616f917e6512ab1 Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 9 Sep 2022 14:06:30 +0200 Subject: [PATCH 5/6] Update User_Manual.md added my inverter, using the following payload: `27 1c 07 e4 02 70 07 6c 00 64 00 00 00 00` --- tools/esp8266/User_Manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/esp8266/User_Manual.md b/tools/esp8266/User_Manual.md index df48bb0d..194c0b57 100644 --- a/tools/esp8266/User_Manual.md +++ b/tools/esp8266/User_Manual.md @@ -236,7 +236,7 @@ Gather user inverter information here to understand what differs between some in | Groobi | TSOL-M400 | | 1.0.14 | 2021 | 12-09 | 102 | | | | setje | HM-600 | | 1.0.08 | 2020 | 07-10 | 104 | | | | madmartin | HM-600 | 0.1.4 | 1.0.10 | 2021 | 11-01 | 104 | | | -| | | | | | | | | | +| lumapu | HM-1200 | 0.1.0 | 1.0.12 | 2020 | 06-24 | | | | | | | | | | | | | | | | | | | | | | | | From 63a82d83eac451c56f2704366880a5922fb39beb Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 9 Sep 2022 16:12:59 +0200 Subject: [PATCH 6/6] fixed missing changes from PR #259 --- tools/esp8266/README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/esp8266/README.md b/tools/esp8266/README.md index a4628436..f2fa10db 100644 --- a/tools/esp8266/README.md +++ b/tools/esp8266/README.md @@ -76,11 +76,29 @@ Additional, there are 3 pins, which can be set individual: #### ESP8266 wiring example This is an example wiring using a Wemos D1 mini.
- - +##### Schematic +![Schematic](../../doc/AhoyWemos_Schaltplan.jpg) +##### Symbolic view +![Symbolic](../../doc/AhoyWemos_Steckplatine.jpg) +#### ESP32 wiring example +Example wiring for a 38pin ESP32 module +##### Schematic +![Schematic](../../doc/Wiring_ESP32_Schematic.png) + +##### Symbolic view +![Symbolic](../../doc/Wiring_ESP32_Symbol.png) + +##### ESP32 GPIO settings +For this wiring, set the 3 individual GPIOs under the /setup URL: + +``` +CS D1 (GPIO5) +CE D2 (GPIO4) +IRQ D0 (GPIO16 - no IRQ!) +``` ## 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.