Refactor readme, factored out hardware and flashing in separate document. Integrated MQTT, Webapi, PinMappings related text in the correct sections. Updated documentation / diagrams to reflect the hardware required
This commit is contained in:
parent
1e30323915
commit
71da704d38
174
README.md
Normal file
174
README.md
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
# OpenDTU-OnBattery
|
||||||
|
|
||||||
|
This is a fork from the Hoymiles project [OpenDTU](https://github.com/tbnobody/OpenDTU). This project is still under development but is being used on a day to day basis as well.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Hoymiles inverter support for live data and display of various inverter internal information. (Partial) support for multiple inverters.
|
||||||
|
* MQTT support (with TLS) with partial Home Assistant MQTT Auto Discovery
|
||||||
|
* Automatic inverter power control of a selected Hoymiles inverter to compensate the currently used energy in the household.
|
||||||
|
* Energy meter support with interface options to HTTP JSON based power meters (e.g. Tasmota), MQTT based power meters (e.g. Shelly 3EM) or SDM power meters.
|
||||||
|
* Support for Victron MPPT charge controller using Ve.Direct. cf. Ve.direct: https://www.victronenergy.com/support-and-downloads/technical-information.
|
||||||
|
* Generic voltage based battery support using Victron MPPT charge controller or Hoymiles inverter voltage values to start / stop inverter power output. (with load compensation)
|
||||||
|
* Pylontech battery support via CAN bus interface. State of Charge reported by BMS is used to start / stop inverter power output. Battery data is exported via MQTT (no support for home assistant auto discovery).
|
||||||
|
* Support for Huawei R4850G2 power supply unit that can act as AC charging source. [Overview](https://www.beyondlogic.org/review-huawei-r4850g2-power-supply-53-5vdc-3kw/)
|
||||||
|
* Other features from [OpenDTU](https://github.com/tbnobody/OpenDTU) maintained
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
|
||||||
|
To get started with this project you will need to assemble a few hardware components that allow interfacing with the desired devices. What is needed depends on the use-case but may consist of:
|
||||||
|
|
||||||
|
* ESP32 board that contains the CPU and WIFI connectivity
|
||||||
|
* NRF24L01+ or CMT2300A radio board to interface with the inverter. Please check the list of the supported inverters below for the board needed.
|
||||||
|
* 3.3V / 5V logic level shifter to interface with the Victron MPPT charge controller
|
||||||
|
* SN65HVD230 CAN bus transceiver to interface with a Pylontech battery
|
||||||
|
* MCP2515 SPI / CAN bus transceiver to interface with the Huawei AC PSU
|
||||||
|
* Relais board + 3.3V / 5 V logic level shifter to switch the slot detect on the Huawei AC PSU
|
||||||
|
* Display [Display](docs/Display.md)
|
||||||
|
|
||||||
|
More detailed information on the hardware can be found in the [Hardware and flashing](docs/hardware_flash.md) document.
|
||||||
|
|
||||||
|
### Currently supported Inverters
|
||||||
|
|
||||||
|
| Model | Required RF Module | DC Inputs | MPP-Tracker | AC Phases |
|
||||||
|
| --------------------| ------------------ | --------- | ----------- | --------- |
|
||||||
|
| Hoymiles HM-300 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-400 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-600 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-700 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1000 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1200 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1500 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-300 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-350 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-400 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-450 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-500 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-600 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-700 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-800 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-900 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-1000 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-1600 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMS-1800 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMS-2000 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMT-1800 | CMT2300A | 6 | 3 | 3 |
|
||||||
|
| Hoymiles HMT-2250 | CMT2300A | 6 | 3 | 3 |
|
||||||
|
| Solenso SOL-H350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Solenso SOL-H400 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Solenso SOL-H800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| TSUN TSOL-M350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| TSUN TSOL-M800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| TSUN TSOL-M1600 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
|
||||||
|
**TSUN compatibility remark:**
|
||||||
|
Compatibility with OpenDTU is most likely related to the serial number of the inverter. Current findings indicate that TSUN inverters with a serial number starting with "11" are supported, whereby inverters with a serial number starting with "10" are not.
|
||||||
|
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
Several screenshots of the frontend can be found here: [Screenshots](docs/screenshots/README.md)
|
||||||
|
|
||||||
|
## Configuration and usage
|
||||||
|
|
||||||
|
### First configuration
|
||||||
|
|
||||||
|
* After the [initial flashing](docs/hardware_flash.md#flashing-and-starting-up) of the microcontroller, an Access Point called "OpenDTU-*" is opened. The default password is "openDTU42".
|
||||||
|
* Use a web browser to open the address [http://192.168.4.1](http://192.168.4.1)
|
||||||
|
* Navigate to Settings --> Network Settings and enter your WiFi credentials. The username to access the config menu is "admin" and the password the same as for accessing the Access Point (default: "openDTU42").
|
||||||
|
* OpenDTU then simultaneously connects to your WiFi AP with these credentials. Navigate to Info --> Network and look into section "Network Interface (Station)" for the IP address received via DHCP.
|
||||||
|
* If your WiFi AP uses an allow-list for MAC-addresses, please be aware that the ESP32 has two different MAC addresses for its AP and client modes, they are also listed at Info --> Network.
|
||||||
|
* When OpenDTU is connected to a configured WiFI AP, the "OpenDTU-*" Access Point is closed after 3 minutes.
|
||||||
|
* OpenDTU needs access to a working NTP server to get the current date & time. Both are sent to the inverter with each request. Default NTP server is pool.ntp.org. If your network has different requirements please change accordingly (Settings --> NTP Settings).
|
||||||
|
* Activate Ve.direct, Battery and the AC Charger according to the available hardware
|
||||||
|
* Configure a Power Meter to provide a data source for the current consumption
|
||||||
|
* Configure the Dynamic Power Limiter according to the used battery. Documentation about the power limiter interface and states can be found below.
|
||||||
|
* If desired connect to a home automation system using MQTT or the Webapi.
|
||||||
|
* A documentation of all available MQTT Topics can be found here: [MQTT Documentation](docs/MQTT_Topics.md)
|
||||||
|
* A documentation of the Web API can be found here: [Web-API Documentation](docs/Web-API.md)
|
||||||
|
* Home Assistant auto discovery is supported. [Example image](https://user-images.githubusercontent.com/59169507/217558862-a83846c5-6070-43cd-9a0b-90a8b2e2e8c6.png)
|
||||||
|
|
||||||
|
### Dynamic Power Limiter Interface
|
||||||
|

|
||||||
|
|
||||||
|
#### Power Limiter States
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
* First: When there is no light on the solar panels, the inverter completely turns off and does not answer to OpenDTU! So if you assembled your OpenDTU in the evening, wait until tomorrow.
|
||||||
|
* When there is no data received from the inverter(s) - try to reduce the distance between the openDTU and the inverter (e.g. move it to the window towards the roof)
|
||||||
|
* Under Settings -> DTU Settings you can increase the transmit power "PA level". Default is "minimum".
|
||||||
|
* The NRF24L01+ needs relatively much current. With bad power supply (and especially bad cables!) a 10 µF capacitor soldered directly to the NRF24L01+ board connector brings more stability (pin 1+2 are the power supply). Note the polarity of the capacitor…
|
||||||
|
* You can try to use an USB power supply with 1 A or more instead of connecting the ESP32 to the computer.
|
||||||
|
* Try a different USB cable. Once again, a stable power source is important. Some USB cables are made of much plastic and very little copper inside.
|
||||||
|
* Double check that you have a radio module NRF24L01+ with a plus sign at the end. NRF24L01 module without the plus are not compatible with this project.
|
||||||
|
* There is no possibility of auto-discovering the inverters. Double check you have entered the serial numbers of the inverters correctly.
|
||||||
|
* OpenDTU needs access to a working NTP server to get the current date & time.
|
||||||
|
* If your problem persists, check the [Issues on Github](https://github.com/tbnobody/OpenDTU/issues). Please inspect not only the open issues, also the closed issues contain useful information.
|
||||||
|
* Another source of information are the [Discussions](https://github.com/tbnobody/OpenDTU/discussions/)
|
||||||
|
* When flashing with VSCode Plattform.IO fails and also with ESPRESSIF tool a demo bin file cannot be flashed to the ESP32 with error message "A fatal error occurred: MD5 of file does not match data in flash!" than un-wire/unconnect ESP32 from the NRF24L01+ board. Try to flash again and rewire afterwards.
|
||||||
|
|
||||||
|
## Background
|
||||||
|
|
||||||
|
This project was started from [this](https://www.mikrocontroller.net/topic/525778) discussion (Mikrocontroller.net).
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Features for developers
|
||||||
|
|
||||||
|
### Status
|
||||||
|
|
||||||
|
[](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml)
|
||||||
|
[](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml)
|
||||||
|
[](https://github.com/tbnobody/OpenDTU/actions/workflows/yarnlint.yml)
|
||||||
|
|
||||||
|
### Core technologies used
|
||||||
|
|
||||||
|
* The microcontroller part
|
||||||
|
* Build with Arduino PlatformIO Framework for the ESP32
|
||||||
|
* Uses a fork of [ESPAsyncWebserver](https://github.com/yubox-node-org/ESPAsyncWebServer) and [espMqttClient](https://github.com/bertmelis/espMqttClient)
|
||||||
|
|
||||||
|
* The WebApp part
|
||||||
|
* Build with [Vue.js](https://vuejs.org)
|
||||||
|
* Source is written in TypeScript
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
Generated using: `git log --date=short --pretty=format:"* %h%x09%ad%x09%s" | grep BREAKING`
|
||||||
|
|
||||||
|
```code
|
||||||
|
* 59f43a8 2023-04-17 BREAKING CHANGE: Web API Endpoint /api/devinfo/status requires GET parameter inv=
|
||||||
|
* 318136d 2023-03-15 BREAKING CHANGE: Updated partition table: Make sure you have a configuration backup and completly reflash the device!
|
||||||
|
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
||||||
|
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
||||||
|
* daf847e 2022-11-14 BREAKING CHANGE: Removed deprecated config parsing method
|
||||||
|
* 69b675b 2022-11-01 BREAKING CHANGE: Structure WebAPI /api/livedata/status changed
|
||||||
|
* 27ed4e3 2022-10-31 BREAKING: Change power factor from percent value to value between 0 and 1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
* Building the WebApp
|
||||||
|
* The WebApp can be build using yarn
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd webapp
|
||||||
|
yarn install
|
||||||
|
yarn build
|
||||||
|
```
|
||||||
|
|
||||||
|
* The updated output is placed in the 'webapp_dist' directory
|
||||||
|
* It is only necessary to build the webapp when you made changes to it
|
||||||
|
* Building the microcontroller firmware
|
||||||
|
* Visual Studio Code with the PlatformIO Extension is required for building
|
||||||
|
|
||||||
|
## Related Projects
|
||||||
|
|
||||||
|
* [Ahoy](https://github.com/grindylow/ahoy)
|
||||||
|
* [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles)
|
||||||
|
* [OpenDTU extended to talk to Victrons MPPT battery chargers (Ve.Direct)](https://github.com/helgeerbe/OpenDTU_VeDirect)
|
||||||
@ -20,6 +20,22 @@ To change the device profile, navigate to the "Device Manager" and selected the
|
|||||||
"en": 4,
|
"en": 4,
|
||||||
"cs": 5
|
"cs": 5
|
||||||
},
|
},
|
||||||
|
"victron": {
|
||||||
|
"rx": 22,
|
||||||
|
"tx": 21
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"rx": 27,
|
||||||
|
"tx": 14
|
||||||
|
},
|
||||||
|
"huawei": {
|
||||||
|
"miso": 12,
|
||||||
|
"mosi": 13,
|
||||||
|
"clk": 26,
|
||||||
|
"irq": 25,
|
||||||
|
"power": 33,
|
||||||
|
"cs": 15
|
||||||
|
},
|
||||||
"eth": {
|
"eth": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"phy_addr": -1,
|
"phy_addr": -1,
|
||||||
@ -109,5 +125,15 @@ The json file can contain multiple profiles. Each profile requires a name and di
|
|||||||
| display.clk | number | Clock Pin (e.g. SCL for i2c displays) required for SSD1306 and SH1106. Use 255 for not assigned pins. |
|
| display.clk | number | Clock Pin (e.g. SCL for i2c displays) required for SSD1306 and SH1106. Use 255 for not assigned pins. |
|
||||||
| display.cs | number | Chip Select Pin required for PCD8544. Use 255 for not assigned pins. |
|
| display.cs | number | Chip Select Pin required for PCD8544. Use 255 for not assigned pins. |
|
||||||
| display.reset | number | Reset Pin required for PCD8544, optional for all other displays. Use 255 for not assigned pins. |
|
| display.reset | number | Reset Pin required for PCD8544, optional for all other displays. Use 255 for not assigned pins. |
|
||||||
|
| victron.rx | number | Victron Ve.direct Rx pin |
|
||||||
|
| victron.tx | number | Victron Ve.direct Tx pin |
|
||||||
|
| battery.rx | number | Pylontech CAN bus battery Rx pin |
|
||||||
|
| battery.tx | number | Pylontech CAN bus battery Tx pin |
|
||||||
|
| huawei.miso | number | MISO Pin for Huawei CAN bus interface |
|
||||||
|
| huawei.mosi | number | MOSI Pin for Huawei CAN bus interface |
|
||||||
|
| huawei.clk | number | CLK Pin for Huawei CAN bus interface |
|
||||||
|
| huawei.cs | number | CS Pin for Huawei CAN bus interface |
|
||||||
|
| huawei.irq | number | IRQ Pin for Huawei CAN bus interface |
|
||||||
|
| huawei.power | number | Power Pin for Huawei power control (e.g. using slot detect) |
|
||||||
| led.led0 | number | LED pin for network indication. Blinking = WLAN connected but NTP & MQTT (if enabled) disconnected. On = WLAN, NTP, MQTT connected. Off = Network not connected |
|
| led.led0 | number | LED pin for network indication. Blinking = WLAN connected but NTP & MQTT (if enabled) disconnected. On = WLAN, NTP, MQTT connected. Off = Network not connected |
|
||||||
| led.led1 | number | LED pin for inverter indication. On = All inverters reachable & producing. Blinking = All inverters reachable but not producing. Off = At least one inverter is not reachable. Only inverters with polling enabled are considered. |
|
| led.led1 | number | LED pin for inverter indication. On = All inverters reachable & producing. Blinking = All inverters reachable but not producing. Off = At least one inverter is not reachable. Only inverters with polling enabled are considered. |
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
# MQTT Topics
|
# MQTT Topics
|
||||||
|
|
||||||
The base topic, as configured in the web GUI is prepended to all follwing topics.
|
The base topic, as configured in the web GUI is prepended to all following topics.
|
||||||
|
Serial will be replaced with the serial number of the respective device.
|
||||||
|
|
||||||
## General topics
|
## General topics
|
||||||
|
|
||||||
@ -72,3 +73,85 @@ cmd topics are used to set values. Status topics are updated from values set in
|
|||||||
| [serial]/cmd/limit_nonpersistent_absolute | W | Set the inverter limit as a absolute value. The value will reset to the last persistent value at night without power. The updated value will set immediatly within the inverter but show up in the web GUI and limit_relative topic after around 4 minutes. If you are using a already known inverter (known Hardware ID), the updated value will show up within a few seconds. The value must be published non-retained, otherwise it will be ignored! | Watt (W) |
|
| [serial]/cmd/limit_nonpersistent_absolute | W | Set the inverter limit as a absolute value. The value will reset to the last persistent value at night without power. The updated value will set immediatly within the inverter but show up in the web GUI and limit_relative topic after around 4 minutes. If you are using a already known inverter (known Hardware ID), the updated value will show up within a few seconds. The value must be published non-retained, otherwise it will be ignored! | Watt (W) |
|
||||||
| [serial]/cmd/power | W | Turn the inverter on (1) or off (0) | 0 or 1 |
|
| [serial]/cmd/power | W | Turn the inverter on (1) or off (0) | 0 or 1 |
|
||||||
| [serial]/cmd/restart | W | Restarts the inverters (also resets YieldDay) | 1 |
|
| [serial]/cmd/restart | W | Restarts the inverters (also resets YieldDay) | 1 |
|
||||||
|
|
||||||
|
### Victron MPPT topics
|
||||||
|
|
||||||
|
#### General
|
||||||
|
|
||||||
|
| Topic | R / W | Description | Value / Unit |
|
||||||
|
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
|
||||||
|
| victron/[serial]/PID | R | Product description | text |
|
||||||
|
| victron/[serial]/SER | R | Serial number | text |
|
||||||
|
| victron/[serial]/FW | R | Firmware number | int |
|
||||||
|
| victron/[serial]/LOAD | R | Load output state | ON / OFF |
|
||||||
|
| victron/[serial]/CS | R | State of operation | text e. g. "Bulk" |
|
||||||
|
| victron/[serial]/ERR | R | Error code | text e. g. "No error" |
|
||||||
|
| victron/[serial]/OR | R | Off reasen | text e. g. "Not off" |
|
||||||
|
| victron/[serial]/MPPT | R | Tracker operation mode | text e. g. "MPP Tracker active" |
|
||||||
|
| victron/[serial]/HSDS | R | Day sequence number (0...364) | int in days |
|
||||||
|
|
||||||
|
#### Battery output
|
||||||
|
|
||||||
|
| Topic | R / W | Description | Value / Unit |
|
||||||
|
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
|
||||||
|
| victron/[serial]/V | R | Voltage | Volt (V) |
|
||||||
|
| victron/[serial]/I | R | Current | Ampere (A) |
|
||||||
|
|
||||||
|
#### Solar input
|
||||||
|
|
||||||
|
| Topic | R / W | Description | Value / Unit |
|
||||||
|
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
|
||||||
|
| victron/[serial]/VPV | R | Voltage | Volt (V) |
|
||||||
|
| victron/[serial]/PPV | R | Power | Watt (W) |
|
||||||
|
| victron/[serial]/H19 | R | Yield total (user resettable counter) | Kilo watt hours (kWh) |
|
||||||
|
| victron/[serial]/H20 | R | Yield today | Kilo watt hours (kWh) |
|
||||||
|
| victron/[serial]/H21 | R | Maximum power today | Watt (W) |
|
||||||
|
| victron/[serial]/H22 | R | Yield yesterday | Kilo watt hours (kWh) |
|
||||||
|
| victron/[serial]/H23 | R | Maximum power yesterday | Watt (W) |
|
||||||
|
|
||||||
|
### Pylontech battery topics
|
||||||
|
|
||||||
|
| Topic | R / W | Description | Value / Unit |
|
||||||
|
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
|
||||||
|
| battery/settings/chargeVoltage | R | Voltage | Volt (V) |
|
||||||
|
| battery/settings/chargeCurrentLimitation | R | BMS requested max. charge current | Ampere (A) |
|
||||||
|
| battery/settings/dischargeCurrentLimitation | R | BMS requested max. discharge current | Ampere (A) |
|
||||||
|
| battery/stateOfCharge | R | State of Health | % |
|
||||||
|
| battery/stateOfHealth | R | State of Charge | % |
|
||||||
|
| battery/voltage | R | Actual voltage | Volt (V) |
|
||||||
|
| battery/current | R | Actual current | Ampere (A) |
|
||||||
|
| battery/temperature" | R | Actual temperature | °C |
|
||||||
|
| battery/alarm/overCurrentDischarge | R | Alarm: High discharge current | 0 / 1 |
|
||||||
|
| battery/alarm/underTemperature | R | Alarm: Low temperature | 0 / 1 |
|
||||||
|
| battery/alarm/overTemperature | R | Alarm: High temperature | 0 / 1 |
|
||||||
|
| battery/alarm/underVoltage | R | Alarm: Low voltage | 0 / 1 |
|
||||||
|
| battery/alarm/overVoltage | R | Alarm: High voltage | 0 / 1 |
|
||||||
|
| battery/alarm/bmsInternal | R | Alarm: BMS internal | 0 / 1 |
|
||||||
|
| battery/warning/highCurrentDischarge | R | Warning: High discharge current | 0 / 1 |
|
||||||
|
| battery/warning/lowTemperature | R | Warning: Low temperature | 0 / 1 |
|
||||||
|
| battery/warning/highTemperature | R | Warning: High temperature | 0 / 1 |
|
||||||
|
| battery/warning/lowVoltage | R | Warning: Low voltage | 0 / 1 |
|
||||||
|
| battery/warning/highVoltage | R | Warning: High voltage | 0 / 1 |
|
||||||
|
| battery/warning/bmsInternal | R | Warning: BMS internal | 0 / 1 |
|
||||||
|
| battery/manufacturer | R | Manufacturer | String |
|
||||||
|
| battery/charging/chargeEnabled | R | Charge enabled flag | 0 / 1 |
|
||||||
|
| battery/charging/dischargeEnabled | R | Discharge enabled flag | 0 / 1 |
|
||||||
|
| battery/charging/chargeImmediately | R | Charge immediately flag | 0 / 1 |
|
||||||
|
|
||||||
|
### Huawei AC charger topics
|
||||||
|
| Topic | R / W | Description | Value / Unit |
|
||||||
|
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
|
||||||
|
| huawei/cmd/limit_online_voltage | W | Online voltage (i.e. CAN bus connected) | Volt (V) |
|
||||||
|
| huawei/cmd/limit_online_current | W | Online current (i.e. CAN bus connected) | Ampere (A) |
|
||||||
|
| huawei/cmd/power | W | Controls output pin GPIO to drive solid state relais | 0 / 1 |
|
||||||
|
| huawei/data_age | R | How old the data is | Seconds |
|
||||||
|
| huawei/input_voltage | R | Input voltage | Volt (V) |
|
||||||
|
| huawei/input_current | R | Input current | Ampere (A) |
|
||||||
|
| huawei/input_power | R | Input power | Watt (W) |
|
||||||
|
| huawei/output_voltage | R | Output voltage | Volt (V) |
|
||||||
|
| huawei/output_current | R | Output current | Ampere (A) |
|
||||||
|
| huawei/max_output_current | R | Maximum output current (set using the online limit) | Ampere (A) |
|
||||||
|
| huawei/output_power | R | Output power | Watt (W) |
|
||||||
|
| huawei/input_temp | R | Input air temperature | °C |
|
||||||
|
| huawei/output_temp | R | Output air temperature | °C |
|
||||||
|
| huawei/efficiency | R | Efficiency | Percentage |
|
||||||
@ -4,7 +4,7 @@ Information in JSON format can be obtained through the web API
|
|||||||
|
|
||||||
## List of URLs
|
## List of URLs
|
||||||
|
|
||||||
may be incomplete
|
This list may be incomplete
|
||||||
|
|
||||||
| GET/POST | Auth required | URL |
|
| GET/POST | Auth required | URL |
|
||||||
| -------- | --- | -- |
|
| -------- | --- | -- |
|
||||||
@ -38,6 +38,12 @@ may be incomplete
|
|||||||
| Get+Post | yes | /api/security/config |
|
| Get+Post | yes | /api/security/config |
|
||||||
| Get | yes | /api/security/authenticate |
|
| Get | yes | /api/security/authenticate |
|
||||||
| Get | no | /api/system/status |
|
| Get | no | /api/system/status |
|
||||||
|
| Get | no | /api/verdirectlivedata/status |
|
||||||
|
| Get | no | /api/huawei/status |
|
||||||
|
| Get | no | /api/huawei/config |
|
||||||
|
| Get | no | /api/huawei/limit/config |
|
||||||
|
| Get | no | /api/battery/status |
|
||||||
|
| Get | no | /api/powerlimiter/status |
|
||||||
|
|
||||||
## Examples of Use
|
## Examples of Use
|
||||||
|
|
||||||
@ -488,6 +494,32 @@ $ curl --no-progress-meter http://192.168.10.10/api/eventlog/status?inv=11418186
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Victron REST-API (/api/verdirectlivedata/status):
|
||||||
|
````JSON
|
||||||
|
{
|
||||||
|
"data_age":0,
|
||||||
|
"age_critical":false,
|
||||||
|
"PID":"SmartSolar MPPT 100|30",
|
||||||
|
"SER":"XXX",
|
||||||
|
"FW":"159",
|
||||||
|
"LOAD":"ON",
|
||||||
|
"CS":"Bulk",
|
||||||
|
"ERR":"No error",
|
||||||
|
"OR":"Not off",
|
||||||
|
"MPPT":"MPP Tracker active",
|
||||||
|
"HSDS":{"v":46,"u":"Days"},
|
||||||
|
"V":{"v":26.36,"u":"V"},
|
||||||
|
"I":{"v":3.4,"u":"A"},
|
||||||
|
"VPV":{"v":37.13,"u":"V"},
|
||||||
|
"PPV":{"v":93,"u":"W"},
|
||||||
|
"H19":{"v":83.16,"u":"kWh"},
|
||||||
|
"H20":{"v":1.39,"u":"kWh"},
|
||||||
|
"H21":{"v":719,"u":"W"},
|
||||||
|
"H22":{"v":1.43,"u":"kWh"},
|
||||||
|
"H23":{"v":737,"u":"W"}
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
#### combine curl and jq
|
#### combine curl and jq
|
||||||
|
|
||||||
`jq` can filter specific fields from json output.
|
`jq` can filter specific fields from json output.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 178 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 261 KiB |
191
docs/hardware_flash.md
Normal file
191
docs/hardware_flash.md
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
# Hardware, building and flashing Firmware
|
||||||
|
|
||||||
|
## Hardware you need
|
||||||
|
|
||||||
|
### ESP32 board
|
||||||
|
|
||||||
|
For ease of use, buy a "ESP32 DEVKIT DOIT" or "ESP32 NodeMCU Development Board" with an ESP32-S3 or ESP-WROOM-32 chipset on it.
|
||||||
|
|
||||||
|
Sample Picture:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Also supported: Board with Ethernet-Connector and Power-over-Ethernet [Olimex ESP32-POE](https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware)
|
||||||
|
|
||||||
|
### NRF24L01+ radio board (See inverter table above for supported inverters)
|
||||||
|
|
||||||
|
The PLUS sign is IMPORTANT! There are different variants available, with antenna on the printed circuit board or external antenna.
|
||||||
|
|
||||||
|
Sample picture:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Buy your hardware from a trusted source, at best from a dealer/online shop in your country where you have support and the right to return non-functional hardware.
|
||||||
|
When you want to buy from Amazon, AliExpress, eBay etc., take note that there is a lot of low-quality or fake hardware offered. Read customer comments and ratings carefully!
|
||||||
|
|
||||||
|
A heavily incomplete list of trusted hardware shops in Germany is:
|
||||||
|
|
||||||
|
* [AZ-Delivery](https://www.az-delivery.de/)
|
||||||
|
* [Makershop](https://www.makershop.de/)
|
||||||
|
* [Berrybase](https://www.berrybase.de/)
|
||||||
|
|
||||||
|
This list is for your convenience only, the project is not related to any of these shops.
|
||||||
|
|
||||||
|
### CMT2300A radio board (See inverter table above for supported inverters)
|
||||||
|
|
||||||
|
It is important to get a module which supports SPI communication. The following modules are currently supported:
|
||||||
|
|
||||||
|
* EBYTE E49-900M20S
|
||||||
|
|
||||||
|
The CMT2300A uses 3-Wire half duplex SPI communication. Due to this fact it currently requires a separate SPI bus. If you want to run the CMT2300A module on the same ESP32 as a NRF24L01+ module or a PCD8544 display make sure you get a ESP which supports 2 SPI busses. Currently the SPI bus host is hardcoded to number 2. This may change in future.
|
||||||
|
|
||||||
|
### 3.3V / 5V logic level converter
|
||||||
|
|
||||||
|
The logic level converter is used to interface with the Victron MPPT charge controller and the relay board. It converts the 3.3V logic level used by the ESP32 to 5V logic used by the other devices.
|
||||||
|
|
||||||
|
### SN65HVD230 CAN bus transceiver
|
||||||
|
|
||||||
|
The SN65HVD230 CAN bus transceiver is used to interface with the Pylontech battery. It leverages the CAN bus controller of the ESP32. This CAN bus operates at 500kbit/s
|
||||||
|
|
||||||
|
### MCP2515 CAN bus module
|
||||||
|
|
||||||
|
The MCP2515 CAN bus module consists of a CAN bus controller and a CAN bus transceiver and is used to interface with the Huawei AC charger. This CAN bus operates at 125kbit/s. The module is connected via SPI and currently requires a separate SPI bus. If you want to use the Huawei AC charger make sure to get an ESP which supports 2 SPI busses. Currently the SPI bus host is hardcoded to number 2. This may change in future. Please note: Using the Huawei AC charger in combination with the CMT2300A radio board is not supported at the moment.
|
||||||
|
|
||||||
|
MCP2515 CAN bus modules that are widely available are designed for 5V supply voltage. To make them work with 3.3V / the ESP32 a modification is required. [This modification is described here.](https://forums.raspberrypi.com/viewtopic.php?t=141052)
|
||||||
|
|
||||||
|
### Relay module
|
||||||
|
|
||||||
|
The Huawei PSU can be switched on / off using the slot detect port. This is done by this relay.
|
||||||
|
|
||||||
|
### Power supply
|
||||||
|
|
||||||
|
Use a power supply with 5 V and 1 A. The USB cable connected to your PC/Notebook may be powerful enough or may be not.
|
||||||
|
|
||||||
|
## Wiring up the NRF24L01+ module
|
||||||
|
|
||||||
|
### Schematic
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Symbolic view
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Change pin assignment
|
||||||
|
|
||||||
|
Its possible to change all the pins of the NRF24L01+ module, the Display, the LED etc.
|
||||||
|
The recommend way to change the pin assignment is by creating a custom [device profile](DeviceProfiles.md).
|
||||||
|
It is also possible to create a custom environment and compile the source yourself. This can be achieved by copying one of the [env:....] sections from 'platformio.ini' to 'platformio_override.ini' and editing the 'platformio_override.ini' file and add/change one or more of the following lines to the 'build_flags' parameter:
|
||||||
|
|
||||||
|
```makefile
|
||||||
|
-DHOYMILES_PIN_MISO=19
|
||||||
|
-DHOYMILES_PIN_MOSI=23
|
||||||
|
-DHOYMILES_PIN_SCLK=18
|
||||||
|
-DHOYMILES_PIN_IRQ=16
|
||||||
|
-DHOYMILES_PIN_CE=4
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
|
-DVICTRON_PIN_TX=21
|
||||||
|
-DVICTRON_PIN_RX=22
|
||||||
|
-DPYLONTECH_PIN_RX=27
|
||||||
|
-DPYLONTECH_PIN_TX=14
|
||||||
|
-DHUAWEI_PIN_MISO=12
|
||||||
|
-DHUAWEI_PIN_MOSI=13
|
||||||
|
-DHUAWEI_PIN_SCLK=26
|
||||||
|
-DHUAWEI_PIN_IRQ=25
|
||||||
|
-DHUAWEI_PIN_CS=15
|
||||||
|
-DHUAWEI_PIN_POWER=33
|
||||||
|
```
|
||||||
|
|
||||||
|
It is recommended to make all changes only in the 'platformio_override.ini', this is your personal copy.
|
||||||
|
|
||||||
|
## Flashing and starting up
|
||||||
|
|
||||||
|
### with Visual Studio Code
|
||||||
|
|
||||||
|
* Install [Visual Studio Code](https://code.visualstudio.com/download) (from now named "vscode")
|
||||||
|
* In Visual Studio Code, install the [PlatformIO Extension](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)
|
||||||
|
* Install git and enable git in vscode - [git download](https://git-scm.com/downloads/) - [Instructions](https://www.jcchouinard.com/install-git-in-vscode/)
|
||||||
|
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur): Inside vscode open the command palette by pressing `CTRL` + `SHIFT` + `P`. Enter `git clone`, add the repository-URL `https://github.com/tbnobody/OpenDTU`. Next you have to choose (or create) a target directory.
|
||||||
|
* In vscode, choose File --> Open Folder and select the previously downloaded source code. (You have to select the folder which contains the "platformio.ini" and "platformio_override.ini" file)
|
||||||
|
* Adjust the COM port in the file "platformio_override.ini" for your USB-to-serial-converter. It occurs twice:
|
||||||
|
* upload_port
|
||||||
|
* monitor_port
|
||||||
|
* Select the arrow button in the blue bottom status bar (PlatformIO: Upload) to compile and upload the firmware. During the compilation, all required libraries are downloaded automatically.
|
||||||
|
* Under Linux, if the upload fails with error messages "Could not open /dev/ttyUSB0, the port doesn't exist", you can check via ```ls -la /dev/tty*``` to which group your port belongs to, and then add your user this group via ```sudo adduser <yourusername> dialout``` (if you are using ```arch-linux``` use: ```sudo gpasswd -a <yourusername> uucp```, this method requires a logout/login of the affected user).
|
||||||
|
* There are two videos showing these steps:
|
||||||
|
* [Git Clone and compilation](https://youtu.be/9cA_esv3zeA)
|
||||||
|
* [Full installation and compilation](https://youtu.be/xs6TqHn7QWM)
|
||||||
|
|
||||||
|
### on the commandline with PlatformIO Core
|
||||||
|
|
||||||
|
* Install [PlatformIO Core](https://platformio.org/install/cli)
|
||||||
|
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur)
|
||||||
|
* Adjust the COM port in the file "platformio_override.ini". It occurs twice:
|
||||||
|
* upload_port
|
||||||
|
* monitor_port
|
||||||
|
* build: `platformio run -e generic`
|
||||||
|
* upload to esp module: `platformio run -e generic -t upload`
|
||||||
|
* 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 (search for "master" in the blue font text but click on the white header text!). You need to be logged in with your github account to download the files.
|
||||||
|
Use a ESP32 flash tool of your choice (see next chapter) and flash the `.bin` files to the right addresses:
|
||||||
|
|
||||||
|
| Address | File |
|
||||||
|
| ---------| ---------------------- |
|
||||||
|
| 0x1000 | bootloader.bin |
|
||||||
|
| 0x8000 | partitions.bin |
|
||||||
|
| 0xe000 | boot_app0.bin |
|
||||||
|
| 0x10000 | opendtu-*.bin |
|
||||||
|
|
||||||
|
For further updates you can just use the web interface and upload the `opendtu-*.bin` file.
|
||||||
|
|
||||||
|
#### Flash with esptool.py (Linux)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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.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".
|
||||||
|
* 
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
#### Flash with [ESP_Flasher](https://espressif.github.io/esptool-js/) - web version
|
||||||
|
|
||||||
|
It is also possible to flash it via the web tools which might be more convenient and is platform independent.
|
||||||
|
|
||||||
|
## Flashing an Update using "Over The Air" OTA Update
|
||||||
|
|
||||||
|
Once you have your OpenDTU running and connected to WLAN, you can do further updates through the web interface.
|
||||||
|
Navigate to Settings --> Firmware upgrade and press the browse button. Select the firmware file from your local computer.
|
||||||
|
|
||||||
|
You'll find the firmware file (after a successful 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.
|
||||||
|
|
||||||
|
|
||||||
|
## Builds
|
||||||
|
|
||||||
|
Different builds from existing installations can be found here [Builds](builds/README.md)
|
||||||
|
Like to show your own build? Just send me a Pull Request.
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 146 KiB |
Loading…
Reference in New Issue
Block a user