FinestArcadeArt / Sungrow_DTSU666_esphome

Help for those struggling with the Sungrow DTSU666 and esphome and homeassistant 😘
3 stars 1 forks source link

Parallel to inverter? #2

Open kalaws opened 3 weeks ago

kalaws commented 3 weeks ago

Hello,

Did you somehow set this up so that you read data in parallel to the inverter?

FinestArcadeArt commented 3 weeks ago

Hi kalaws,

I use it as a standalone power meter. My friend got a few of them from work and wanted to use them to measure power usage per room. I'll grab one of those myself this week. Said friend was out of country for the last 3 months so I didn't get to test the code myself. I'm pretty sure that it works though, as I developed it with him on a video-call (If you find some weird language, that was him 🙄)

Let me explain how it works

To use the DTSU666 with esphome, you need an ESP (needless to say) and a Modbus adapter for the communication between those two. Sungrow has them flashed with a custom firmware which uses different register locations. This project uses the correct registers for the Sungrow DTSU666. If you worked with esphome before, you should immediately notice the regular boilerplate stuff in the .yaml file:

esphome:
  name: schundmeter
  friendly_name: schundmeter

esp8266:
  board: esp01_1m

# Enable logging
logger:
  level: WARN

# Enable Home Assistant API
api:
  encryption:
    key: "YohrsCVL3OixlSyAQ31cFaSo1tOjhW/vTfWeN0GFjxk="

ota:
  password: "fa91438ec2b936dbdc92e9c4dacfe629"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Schundmeter Fallback Hotspot"
    password: "jKThN2NNyCpc"

# Enable Web server
web_server:
  port: 80

captive_portal:
###

The pins where the modbus adapter is conneted to is defined in the uart section:

uart:
  id: mod_bus
  tx_pin: GPIO13 # connected to tx on modbus converter
  rx_pin: GPIO12 # connected to rx on modbus converter
  baud_rate: 9600
  stop_bits: 1
  data_bits: 8

You just need to create a new device in the esphome and copy the contents from the .yaml file, then flash the ESP as always. The device created will be called schundmeter.

I don't know how versed you are when it comes to electronics, but one word of advice: Don't ever connect Tx <-> Tx, as it will almost certainly kill one of your devices without you noticing! It should be Tx (transmit) -> Rx (receive).

Why am I telling you this? I don't wanna know how many serial interfaces I fried when I started with electronics by doing so. Sometimes the pins are even labeled the wrong way!

I'll add a few pictures of the wiring and the Modbus adapter we used in the next days. I hope this helps. If you're still having questions, don't hesitate to ask them here

TL;DR

No, I use them standalone