Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Platform.io and OTA Updates #4

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@

.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["platformio.platformio-ide"]
}
193 changes: 0 additions & 193 deletions DanfossTLX-REST-LolinD32.ino

This file was deleted.

File renamed without changes.
93 changes: 58 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Danfoss-TLX
RS485 Communication with Danfoss TLX solar inverter and REST server

RS485 Communication with Danfoss TLX solar inverter and REST server. Based on [TLX-ino by Torben](https://github.com/TorbenNor/Danfoss-TLX).

I use it for Home Assistant integration where each parameter/value can be read as a sensor.

See DanfossTLX-RS485.h for parameters

sensor:
# Danfoss TLX
# Energy
- platform: rest
resource: http://[IP-Address]/TotalE
name: "TLX Total Energy Production"
method: GET
value_template: "{{ value_json.value |round(3)}}"
unit_of_measurement: kWh
device_class: 'energy'
state_class: total_increasing

See DanfossTLX-RS485.h for parameters.

[@exetico](https://github.com/exetico) have added support for Platform.io, and I'll recommend you to start with that, instead of the (a bit) aging Arduno IDE software.

```yaml
sensor:
# Danfoss TLX
# Energy
- platform: rest
resource: http://[IP-Address]/TotalE
name: "TLX Total Energy Production"
method: GET
value_template: "{{ value_json.value |round(3)}}"
unit_of_measurement: kWh
device_class: "energy"
state_class: total_increasing
```

But since HA would fire request for all entities almost at the same time it could'nt keep up and some would end up unavailable.
So instead of having each value returned in a seperat call i've added them all in stame same json return. See configuration.yaml for all rest sensors

```yaml
rest:
- resource: http://[IP-Address]/All
sensor:
Expand All @@ -30,41 +36,58 @@ So instead of having each value returned in a seperat call i've added them all i
value_template: "{{ value_json.OpModeTxt }}"
- name: "TLX Product Number"
value_template: "{{ value_json.Product }}"
- name: "TLX Serial"
value_template: "{{ value_json.Serial }}"
- name: "TLX Serial"
value_template: "{{ value_json.Serial }}"
# Produkction Energy
- name: "TLX Total Energy Production"
value_template: "{{ value_json.TotalE |round(3)}}"
unit_of_measurement: kWh
device_class: 'energy'
state_class: total_increasing
...
...

Based on TLX-ino by Torben https://github.com/TorbenNor/Danfoss-TLX

```

Board LOLIN D32
https://www.aliexpress.com/item/32808551116.htm
Pin 16 :RXD2 Seriel in
Pin 17 :TXD2 Seriel out
R411A01 mini 3.3V Auto RS485 to TTL232 Converter Board
https://www.aliexpress.com/item/32782552104.html
For this project, I'll use pin 16 for RX (Serial2), and pin 17 for TX (Serial2).

If you face any problems with the communication between the Danfoss device and the ESP, try and swap TX and RX.

## Libraries

Used Libraries - output from verbose compile
Multiple libraries were found for "WiFi.h" Used: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
Using library WiFi at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
Using library WebServer at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WebServer
Using library ArduinoJson at version 6.19.4 in folder: ...\libraries\ArduinoJson
Using library FS at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\FS
Multiple libraries were found for "WiFi.h" Used: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
Using library WiFi at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi
Using library WebServer at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\WebServer
Using library ArduinoJson at version 6.19.4 in folder: ...\libraries\ArduinoJson
Using library FS at version 2.0.0 in folder: ...\packages\esp32\hardware\esp32\2.0.3\libraries\FS

## How to use

### Platform.io

Open the project, and do whatever you'd normally do with Platform.io. Here you're also able to use OTA updates in the future, after the first flash by USB.

### Arduino IDE

Secure that you've downloaded the libs, and use the source-code from the `src` folder.

If you face any problems with compiling with Arduino IDE, kindly give Platform.io a try in VS Code.

With that said, try and rename the `main.ccp` file to `main.ino`.

## BOM

LOLIN D32 (ESP32): [AliExpres](https://www.aliexpress.com/item/32808551116.htm)

_The project can be used with other ESP32 boards._

R411A01 mini 3.3V Auto RS485 to TTL232 Converter Board: [AliExpress](https://www.aliexpress.com/item/32782552104.html)

_You can use other RS485 to TTL232 boards._

# BOM:
esp32 lolin.
## Details about RS485 and ComLynx

R411A01 mini 3.3V Auto RS485 to TTL232 Converter Board or similar.
Kindly check the `Assets` folder for more info. Here you'll find `ComLynx_User_Guide_16_20120817_A7.pdf`, a guide to accessing inverter parameters via RS485 using ComLynx protocol. The file are originally made by Danfoss.

## Note about OTA

Disclaimer: OTA are not tested. Normally you'd need to prioritize the OTA request, for things to work smoothly.
Loading