Skip to content

Commit

Permalink
Merge remote-tracking branch 'tbnobody/OpenDTU/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Oct 26, 2022
2 parents 61fd54b + 13b22de commit a6d7340
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 69 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: tbnobody
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 🐛 Bug Report
description: File a bug report
labels: ["bug"]
body:
- type: markdown
attributes:
value: >
### ✋ **This is bug tracker, not a support forum**
If something isn't working right, you have questions or need help, [**get in touch on the Discussions**](https://github.com/tbnobody/OpenDTU/discussions).
Please quickly search existing issues first before submitting a bug.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: A clear and concise description of what the bug is.
placeholder: Tell us what the problem is.
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: To Reproduce Bug
description: Steps to reproduce the behavior, if consistently possible.
placeholder: Tell us how to make the bug appear.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
placeholder: Tell us what you expected to happen.
validations:
required: true
- type: dropdown
id: install_format
attributes:
label: Install Method
description: How did you install OpenDTU?
options:
- Pre-Compiled binary from GitHub
- Self-Compiled
validations:
required: true
- type: input
id: version
attributes:
label: What git-hash/version of OpenDTU?
description: You can find this in by going to Info -> System
placeholder: "e.g. 359d513"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log/trace output
description: Please copy and paste any relevant log output if you have it. This will be automatically formatted into code, so no need for backticks.
render: Shell
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: ✨ Request a feature
description: Suggest an improvement idea for OpenDTU!
title: "[Request]"
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: >
**Thank you for wanting to request a feature in OpenDTU!**
Before you go ahead with your request, please first consider if it wouldn't be
better suited in a external home automation software like OpenHAB, ioBroker, Home Assistant etc.
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]".
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.


34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project was started from [this](https://www.mikrocontroller.net/topic/52577
It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.

## Screenshots
Several screenshots of the frontend can be found here: [Screenshots](docs/screenshots)
Several screenshots of the frontend can be found here: [Screenshots](docs/screenshots/README.md)

I extended the original OpenDTU software to support also Victron's Ve.Direct protocol on the same chip. Additional information about Ve.direct can be downloaded from https://www.victronenergy.com/support-and-downloads/technical-information.

Expand Down Expand Up @@ -162,9 +162,10 @@ This can be achieved by editing the 'platformio.ini' file and add/change one or
* other options:
* clean the sources: `platformio run -e generic -t clean`
* erase flash: `platformio run -e generic -t erase`

### using the pre-compiled .bin files
The pre-compiled files can be found on the [github page](https://github.com/tbnobody/OpenDTU) in the tab "Actions" and the sub menu "OpenDTU Build". Just choose the latest build from the master branch (blue font). You need to be logged in with your github account to download the files.
Use a ESP32 flash tool of your choice and flash the .bin files to the right addresses:
Use a ESP32 flash tool of your choice (see next chapter) and flash the `.bin` files to the right addresses:

| Address | File |
| ---------| ---------------------- |
Expand All @@ -173,8 +174,31 @@ Use a ESP32 flash tool of your choice and flash the .bin files to the right addr
| 0xe000 | boot_app0.bin |
| 0x10000 | opendtu-*.bin |

Make sure too uncheck the DoNotChgBin option. Otherwise you will maybe get errors like "invalid header".
For further upgraded you can just use the web interface and upload the opendtu-*.bin file.
For further updates you can just use the web interface and upload the `opendtu-*.bin` file.

### Flash with esptool.py (Linux)
```
esptool.py --port /dev/ttyUSB0 --chip esp32 --before default_reset --after hard_reset \
write_flash --flash_mode dout --flash_freq 40m --flash_size detect \
0x1000 bootloader_dio_40m.bin \
0x8000 partitions.bin \
0xe000 boot_app0.bin \
0x10000 opendtu-generic.bin
```

### Flash with Espressif Flash Download Tool (Windows)

[Download link](https://www.espressif.com/en/support/download/other-tools)

- On startup, select Chip Type -> "ESP32" / WorkMode -> "Develop"
- Prepare all settings (see picture). Make sure to uncheck the `DoNotChgBin` option. Otherwise you may get errors like "invalid header".
- ![flash tool image](docs/esp32_flash_download_tool.png)
- Press "Erase" button on screen. Look into the terminal window, you should see dots appear. Then press the "Boot" button on the ESP32 board. Wait for "FINISH" to see if flashing/erasing is done.
- To program, press "Start" on screen, then the "Boot" button.
- When flashing is complete (FINISH appears) then press the Reset button on the ESP32 board (or powercycle ) to start the OpenDTU application.

### Flash with ESP_Flasher (Windows)
Users report that [ESP_Flasher](https://github.com/Jason2866/ESP_Flasher/releases/) is suitable for flashing OpenDTU on Windows.

## First configuration
* After the initial flashing of the microcontroller, an Access Point called "OpenDTU-*" is opened. The default password is "openDTU42".
Expand All @@ -191,6 +215,8 @@ Navigate to Settings --> Firmware upgrade and press the browse button. Select th

You'll find the firmware file (after a successfull build process) under `.pio/build/generic/firmware.bin`.

If you downloaded a precompiled zip archive, unpack it and choose `opendtu-generic.bin`.

After the successful upload, the OpenDTU immediately restarts into the new firmware.

## MQTT Topic Documentation
Expand Down
Binary file added docs/esp32_flash_download_tool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions docs/screenshots/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# OpenDTU Screenshots

here are some screenshots of OpenDTU's web interface.

***

![](01_LiveView.png)

***

![](02_NetworkAdmin.png)

***

![](03_NtpAdmin.png)

***

![](04_MqttAdmin.png)

***

![](05_InverterAdmin.png)

***

![](06_DtuAdmin.png)

***

![](07_FirmwareUpgrade.png)

***

![](08_NetworkInfo.png)

***

![](09_NtpInfo.png)

***

![](10_MqttInfo.png)

***

![](11_SystemInfo.png)

***

![](12_Eventlog.png)

***

![](13_InverterSettings.png)

***

![](14_ConfigManagement.png)

***

![](15_LimitSettings.png)

***

![](16_PowerSettings.png)

***

![](17_InverterInfo.png)
1 change: 1 addition & 0 deletions include/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
class Utils {
public:
static uint32_t getChipId();
static uint64_t generateDtuSerial();
};
23 changes: 23 additions & 0 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,27 @@ uint32_t Utils::getChipId()
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
return chipId;
}

uint64_t Utils::generateDtuSerial()
{
uint32_t chipId = getChipId();
uint64_t dtuId = 0;

// Product category (char 1-4): 1 = Micro Inverter, 999 = Dummy
dtuId |= 0x199900000000;

// Year of production (char 5): 1 equals 2015 so hard code 8 = 2022
dtuId |= 0x80000000;

// Week of production (char 6-7): Range is 1-52 s hard code 1 = week 1
dtuId |= 0x0100000;

// Running Number (char 8-12): Derived from the ESP chip id
for (uint8_t i = 0; i < 5; i++) {
dtuId |= (chipId % 10) << (i * 4);
chipId /= 10;
}

return dtuId;
}
18 changes: 16 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#include "MqttPublishing.h"
#include "MqttVedirectPublishing.h"
#include "MqttSettings.h"
#include "NetworkSettings.h"
#include "NtpSettings.h"
#include "Utils.h"
#include "WebApi.h"
#include "NetworkSettings.h"
#include "defaults.h"
#include <Arduino.h>
#include <LittleFS.h>
Expand Down Expand Up @@ -79,9 +80,22 @@ void setup()
WebApi.init();
Serial.println(F("done"));

// Check for default DTU serial
Serial.print(F("Check for default DTU serial... "));
CONFIG_T& config = Configuration.get();
if (config.Dtu_Serial == DTU_SERIAL) {
Serial.print(F("generate serial based on ESP chip id: "));
uint64_t dtuId = Utils::generateDtuSerial();
Serial.printf("%0x%08x... ",
((uint32_t)((dtuId >> 32) & 0xFFFFFFFF)),
((uint32_t)(dtuId & 0xFFFFFFFF)));
config.Dtu_Serial = dtuId;
Configuration.write();
}
Serial.println(F("done"));

// Initialize inverter communication
Serial.print(F("Initialize Hoymiles interface... "));
const CONFIG_T& config = Configuration.get();
Hoymiles.init();

Serial.println(F(" Setting radio PA level... "));
Expand Down
8 changes: 4 additions & 4 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
"bootstrap-icons-vue": "^1.8.1",
"spark-md5": "^3.0.2",
"vue": "^3.2.41",
"vue-router": "^4.1.5"
"vue-router": "^4.1.6"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@types/bootstrap": "^5.2.5",
"@types/node": "^18.11.0",
"@types/node": "^18.11.4",
"@types/spark-md5": "^3.0.2",
"@vitejs/plugin-vue": "^3.1.2",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.25.0",
"eslint": "^8.26.0",
"eslint-plugin-vue": "^9.6.0",
"npm-run-all": "^4.1.5",
"typescript": "^4.8.4",
"vite": "^3.1.8",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-css-injected-by-js": "^2.1.0",
"vue-tsc": "^1.0.8"
"vue-tsc": "^1.0.9"
}
}
2 changes: 1 addition & 1 deletion webapp/src/views/DtuAdminView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="row mb-3">
<label for="inputDtuSerial" class="col-sm-2 col-form-label">Serial:</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="inputDtuSerial" min="1" max="99999999999"
<input type="number" class="form-control" id="inputDtuSerial" min="1" max="199999999999"
placeholder="DTU Serial" v-model="dtuConfigList.dtu_serial" />
</div>
</div>
Expand Down
Loading

0 comments on commit a6d7340

Please sign in to comment.