Create custom uart sensor - Delta Solivia Inverter 3.0 EU G4 TR

Hi
I will enable log tomorrow.
It finds ETX so it’s ok and sends data.
BR
Mark

Hi
I can’t see where it’s going wrong, I’ll have to look at it tomorrow

[18:14:40][D][uart_debug:114]: >>> 02:05:01:02:60:01:85:FC:03
[18:14:40][D][uart_debug:114]: <<< 02:06:01:96:60:01:45:4F:45:34:36:30:31:30:31:39:30:31:31:33:31:39:30:31:36:31:30:34:30:30:30:32:37:33:35:31:30:34:30:31:36:02:32:1B:02:32:1B:02:32:1B:02:32:1B:00:D7:00:02:07:D0:00:1B:00:00:00:02:00:EB:00:1E:13:8C:00:19:5B:CC:13:8C:00:00:5B:CC:13:8D:00:00:02:95:02:74:00:8E:00:E0:00:F7:0D:66:13:79:13:98:00:03:E1:03:00:00:69:A1:00:C0:01:33:0E:E5:00:00:08:98:00:00:00:08:00:00:00:00:00:00:00:00:00:00:00:01:01:01:01:01:01:01:01:01:01:01:01:01:01:01:01
[18:14:40][D][sensor:126]: 'Solar daily yield': Sending state 661.00000 Wh with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar total yield': Sending state 16843.00977 kWh with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar DC voltage': Sending state 215.00000 V with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar DC current': Sending state 0.20000 A with 1 decimals of accuracy
[18:14:40][D][sensor:126]: 'DC Power': Sending state 6914.00000 W with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar AC voltage': Sending state 235.00000 V with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar AC current': Sending state 0.20000 A with 1 decimals of accuracy
[18:14:40][D][sensor:126]: 'AC power': Sending state 53248.00000 W with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Solar frequency': Sending state 0.30000 Hz with 2 decimals of accuracy
[18:14:40][D][sensor:126]: 'Heat sink #1': Sending state 27.00000 °C with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'Heat sink #2': Sending state 25.00000 °C with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'ISO +': Sending state 2000.00000 kΩ with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'ISO -': Sending state 0.00000 kΩ with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'unknown_0x64': Sending state 0.00000 W with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'unknown_0x65': Sending state 105.00000 W with 0 decimals of accuracy
[18:14:40][D][sensor:126]: 'unknown_0x91': Sending state 1.00000 W with 0 decimals of accuracy
[18:14:40][I][custom:145]: ETX check OK: 3
[18:14:40][I][custom:146]: Daily yield: 661 Wh
[18:14:40][I][custom:147]: Current production: 53248 W
[18:14:40][D][uart_debug:114]: <<< 01:01:01:01:89:4B:03
[18:14:50][D][uart_debug:114]: >>> 02:05:01:02:60:01:85:FC:03
[18:14:50][D][uart_debug:114]: <<< 02:06:01:96:60:01:45:4F:45:34:36:30:31:30:31:39:30:31:31:33:31:39:30:31:36:31:30:34:30:30:30:32:37:33:35:31:30:34:30:31:36:02:32:1B:02:32:1B:02:32:1B:02:32:1B:00:D5:00:02:07:D0:00:1B:00:00:00:02:00:EB:00:1E:13:8B:00:19:5B:CC:13:8B:00:00:5B:CC:13:8A:00:00:02:95:02:74:00:8E:00:E0:00:F7:0D:66:13:79:13:98:00:03:E1:03:00:00:69:A1:00:C0:01:33:0E:E5:00:00:08:98:00:00:00:08:00:00:00:00:00:00:00:00:00:00:00:01:01:01:01:01:01:01:01:01:01:01:01:01:01:01:01
[18:14:50][D][sensor:126]: 'AC power': Sending state 53248.00000 W with 0 decimals of accuracy
[18:14:50][I][custom:145]: ETX check OK: 3
[18:14:50][I][custom:146]: Daily yield: 661 Wh
[18:14:50][I][custom:147]: Current production: 53248 W

Hi
It’s probably mostly the power that’s wrong
I’ll have to check if the others are correct tomorrow
BR Mark

Hi’ @Egelyggard

I’ve been through your register values and revised three of them (AC Power, AC Frequency and Total supplied power kWh). See my revised code sniplet below.

Apparently there’s no DC Power register in your inverter, so I’ve deleted that one and my three test (unknown) registers as well. Remember to remove them as well in the ESPHome config and the sensor declaration in solivia.h

Note that the scaling for both daily yield (d_yield) and total yield (t_yield) differs between yours and my inverter. Also makes more sense if your inverter has produced 6610 Wh yesterday and not just 661 Wh :slightly_smiling_face: So you’ll have to revise these sensors to:

- name: "Solar daily yield"
    #icon: mdi:SolarPower
    device_class: energy
    # Set state_class in order for HA to use sensor in the Energy component
    state_class: total_increasing
    unit_of_measurement: Wh
    accuracy_decimals: 0
    filters:
    - throttle: 60s
    - multiply: 10

If your Inverter total yield yesterday was 254211/10 = 25421,10 kWh, then total yield will need a revised filter line to:
- multiply: 0.1

        TwoByte dc_v_data;
        dc_v_data.Byte[0] = bytes[0x30 +6]; // Solar voltage lsb
        dc_v_data.Byte[1] = bytes[0x2F +6]; // Solar voltage msb
        TwoByte dc_a_data;
        dc_a_data.Byte[0] = bytes[0x32 +6]; // Solar current lsb
        dc_a_data.Byte[1] = bytes[0x31 +6]; // Solar current msb

        TwoByte ac_a_data;
        ac_a_data.Byte[0] = bytes[0x3A + 6]; // AC current lsb
        ac_a_data.Byte[1] = bytes[0x39 + 6]; // AC current msb
        TwoByte ac_v_data;
        ac_v_data.Byte[0] = bytes[0x3C + 6]; // AC voltage lsb
        ac_v_data.Byte[1] = bytes[0x3B + 6]; // AC voltage lsb
        TwoByte freq_data;
        freq_data.Byte[0] = bytes[0x40 + 6]; // Frequency lsb
        freq_data.Byte[1] = bytes[0x3F + 6]; // Frequency msb
        TwoByte ac_power_data;
        ac_power_data.Byte[0] = bytes[0x3E +6]; // AC Power lsb
        ac_power_data.Byte[1] = bytes[0x3D +6]; // AC Power msb
        
        TwoByte iso_plus_data;
        iso_plus_data.Byte[0] = bytes[0x34 +6]; // Solar isolation resistance lsb
        iso_plus_data.Byte[1] = bytes[0x33 +6]; // Solar isolation resistance msb
        TwoByte iso_minus_data;
        iso_minus_data.Byte[0] = bytes[0x38 +6]; // Solar input MOV resistance lsb
        iso_minus_data.Byte[1] = bytes[0x37 +6]; // Solar input MOV resistance msb

        TwoByte hs_1_data;
        hs_1_data.Byte[0] = bytes[0x36 +6]; // Calculated temperature at ntc (DC side) lsb
        hs_1_data.Byte[1] = bytes[0x35 +6]; // Calculated temperature at ntc (DC side) msb
        TwoByte hs_2_data;
        hs_2_data.Byte[0] = bytes[0x42 +6]; // Calculated temperature at ntc (AC side) lsb
        hs_2_data.Byte[1] = bytes[0x41 +6]; // Calculated temperature at ntc (AC side) msb

        TwoByte d_yield_data;
        d_yield_data.Byte[0] = bytes[0x50 +6]; // Daily yield lsb - Scaling x10
        d_yield_data.Byte[1] = bytes[0x4F +6]; // Daily yield msb - Scaling x10
        uint32_t t_yield_data = int(
            (unsigned char)(bytes[0x5F +6]) << 24 |
            (unsigned char)(bytes[0x60 +6]) << 16 |
            (unsigned char)(bytes[0x61 +6]) << 8 |
            (unsigned char)(bytes[0x62 +6]));  // Total yield (4 bytes float)

That’s it, I guess.
Almost there, only missing the last bits :laughing:

Regards
Henning

Hi
I’ve got it set up with an inverter and am getting data out now and have also tried to do the ‘quick and dirty’ solution but I can’t get it to work.
I have also tried to do it in solivia.h but I can’t get that to work either unfortunately,
But for a simple inverter it works super.
have a nice weekend
BR
Mark

Hi’

Great you got it working with one inverter :+1::slightly_smiling_face:
All values correct now in your end ?

In order to get it working properly with all three inverters, I would suggest that you

  1. Ensure cascade cabling is working. If you’re requesting data from inverter#3, then connect ESP to inverter#1. Cable from Inverter #1 to #2. And last cable from inverter #2 to #3. This has to work before you can proceed.
  2. Ensure that all three inverters are not sending their response simultaniously. Don’t know if Inverter com sw is ‘intelligent’ and wait with a response until serial line is idle ? So spread our your requests to all three inverters with some seconds delay.
  3. If inverter com sw actually checks if serial line is idle, then you could also experiment with the global destination address #FF. If this works as expected, you could get packages returned from all three inverters with only one single command

Hi
YES they can’t send as much as the G4, but what I need they can
All hardware setup is as it should be - it works with my python script.
There is a 3 second pause between requests.
BR
Mark

Hi’

Well, I really can’t see any reason why you shouldn’t be able to get it to work with ESPHome on all three inverters simultaniously.

How does the Python script work ? Also sending the individual inverter requests with some seconds delay ?

If you share your ESPHome config and a log sniplet, I might be able to help further with this :slightly_smiling_face:

Regards
Henning

Hi Henning
Now it succeeded in getting all 3 inverter to work :slight_smile:
Tak for din hjælp :slight_smile:

[14:54:08][D][sensor:126]: 'PV1 Solar daily yield': Sending state 3930.00000 Wh with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 DC voltage': Sending state 225.00000 V with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 DC current': Sending state 3.10000 A with 1 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 AC voltage': Sending state 232.00000 V with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 AC current': Sending state 3.10000 A with 1 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 AC power': Sending state 660.00000 W with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 Heat sink #1': Sending state 30.00000 °C with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 Heat sink #2': Sending state 28.00000 °C with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 ISO +': Sending state 2000.00000 kΩ with 0 decimals of accuracy
[14:54:08][D][sensor:126]: 'PV1 ISO -': Sending state 0.00000 kΩ with 0 decimals of accuracy
[14:54:08][I][custom:130]: ETX check OK: 3
[14:54:08][I][custom:131]: Inverter 1
[14:54:08][I][custom:132]: Daily yield: 393 Wh
[14:54:08][I][custom:133]: Current production: 660 W
[14:54:11][I][custom:262]: ETX check OK: 3
[14:54:11][I][custom:263]: Inverter 3
[14:54:11][I][custom:264]: Daily yield: 57 Wh
[14:54:11][I][custom:265]: Current production: 120 W
[14:54:13][D][sensor:126]: 'PV2 Solar daily yield': Sending state 3770.00000 Wh with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 DC voltage': Sending state 234.00000 V with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 DC current': Sending state 2.90000 A with 1 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 AC voltage': Sending state 231.00000 V with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 AC current': Sending state 3.10000 A with 1 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 AC power': Sending state 640.00000 W with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 Heat sink #1': Sending state 32.00000 °C with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 Heat sink #2': Sending state 28.00000 °C with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 ISO +': Sending state 2000.00000 kΩ with 0 decimals of accuracy
[14:54:13][D][sensor:126]: 'PV2 ISO -': Sending state 0.00000 kΩ with 0 decimals of accuracy
[14:54:13][I][custom:196]: ETX check OK: 3
[14:54:13][I][custom:197]: Inverter 2
[14:54:13][I][custom:198]: Daily yield: 377 Wh
[14:54:13][I][custom:199]: Current production: 640 W
[14:54:17][D][sensor:126]: 'PV3 Solar daily yield': Sending state 570.00000 Wh with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 DC voltage': Sending state 264.00000 V with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 DC current': Sending state 0.40000 A with 1 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 AC voltage': Sending state 235.00000 V with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 AC current': Sending state 0.50000 A with 1 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 AC power': Sending state 120.00000 W with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 Heat sink #1': Sending state 28.00000 °C with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 Heat sink #2': Sending state 22.00000 °C with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 ISO +': Sending state 2000.00000 kΩ with 0 decimals of accuracy
[14:54:17][D][sensor:126]: 'PV3 ISO -': Sending state 0.00000 kΩ with 0 decimals of accuracy
[14:54:17][I][custom:262]: ETX check OK: 3
[14:54:17][I][custom:263]: Inverter 3
[14:54:17][I][custom:264]: Daily yield: 57 Wh
[14:54:17][I][custom:265]: Current production: 120 W
[14:54:19][I][custom:262]: ETX check OK: 3
[14:54:19][I][custom:263]: Inverter 3
[14:54:19][I][custom:264]: Daily yield: 57 Wh
[14:54:19][I][custom:265]: Current production: 120 W

Hi’ @Egelyggard

Great news and well done :muscle::+1::slightly_smiling_face:
Your daily yield still looks a bit strange though. Only 57Wh in yield on inverter#3 at 15.00 hours in the afternoon seems quite odd - even for Denmark :wink:

If you wish, I could add your working config to the repository as well.
Just PM me the config and other relevant info.

Regards
Henning

Hi @htvekov
Thanks, it’s been running for a few days now and works perfectly.
Daily yield is good enough, there is only 1KW on that inverter and then it has to be multiplied by 10, but I do that in the yaml file. :stuck_out_tongue_winking_eye:
I have posted what I have made in github here GitHub - it-koncept/Solvia-Inverter-G3. :+1: :slight_smile:
Now I’m struggling to see if I can use it to talk to my biomax boiler - I can see I don’t 100% understand what’s going on in solivia.h. :laughing:

1 Like

Hi’ @Egelyggard

Great - and well done :muscle::wink:
I’ll crossreference to your solution as well from my github.

Throw me a PM if you need assistance with you next Biomax boiler project :slightly_smiling_face:

Hi Henning,
I currently am having difficulty with reading the Delta Solivia registers with special node-red modbus nodes connected to a Waveshare RS485 to ETH. The nodes need digital register values and I can’t for the life of me understand how to get these from the Delta published document. I can’t see any digital addresses and from where to where to read them.
Furthermore, I am experimenting with the RS485 to TTL and WEMOS D1 wifi module and reading through the files on your Github. But again, it sounds stupid, but have no clue what to do. How to or more importantly with what to flash the WEMO. Are you able to point me in the right direction how to implement the RS485 to TTL Wifi.
Your help is greatly appreciated. I am ICT proficient but this Modbus register address bits and HEX etc is gibberish to me.
Kind regards,
Jaap

So, trying further I managed to implement the YAML from Hennings Github. Of course being ESPhome it is the file from which to build the BIN to flash the wemos.
I have the Solivia 2.5 G3. From the official Delta file, referred to in this thread, that is variant 15. The adresses are the same as Hennings 3 G4 (variant 34). So I only changed the Wifi bit in the YAML
Unfortunately the values show up in HA as unknown. The ESP logs only show the Wifi sensors updating.


Again some help would be appreciated.
Thank you and kind regards,

Jaap

@jabo59

OK, the ESPHome bit seems to be ok and sorted now.

Check (in the inverter menu) that the baud rate is correct (19200) and device number is 1

The read rx led on the RS485 to TTL module should flash appx. once every second. If not, no data is recieved.

How have you connected the RS485 module to the inverter ? I’ve only conected the A+ and B+ pads to rx/tx on the inverters RJ45 connector.
Note that there are two different pin configurations depending on what inverter you have !!

Also enable debug log in the uart settings to see the hex data recieved
(if you haven’t already done that)

Hi Henning,

Thank you for the effort. The inverter switches off when it becomes too dark, so just looking at it now. The inverter has device ID 1 and the baud rate is correct
I used the G3 wiring scheme, so green is RXB and brown/white is TXA.
I only see the RX flashing in very high frequency and no activity on the TX. In the logging I see the HEX request being sent, no reply however
This what I did, with no result:
-switched from hardware uart to software uart.
-switched RX and TX cable ends
-fabricated new cable

I am inclined to think that my RS485 TTL module is faulty.

Here is a snip from the log after switching to software uart:

Since you’re requesting the data package from the ESPHome every 10 seconds (that request mimics the gateways constant requests), I assume that you’ve not connected the gateway at the same time to the inverter.

With very high frequency, do you mean almost constant as in a flickering led ?
That shouldn’t happen. The rx led should only flash shortly for every package recieved. Tx led should very briefly flash as well (hardly notisable), as you’re sending the package request from the ESPHome and not just sniffing data packages.

Could very well be that your RS485 module won’t work with the Solivia inverter. I had issues with one specific model. Initially I thought it might just be a defective module. But no, I tested three identical modules that all failed communicating with the Solivia inverter. All three modules worked perfectly with my iEM3155 energy meter though. I switched to another seemingly identical module from a different vendor and immediately received packages from the Solivia inverter. The two modules visually looks completely identical. Only minor variations regarding pcb layout and components. Really strange issue, but I didn’t dig further into it, as my other module version worked perfectly. Check out this thread for additional details.

You could also try and connect GND on the inverter with GND on the ESP device. Should be neccesary, but worth a shot.

I’m powering my RS485 module straight from the ESP8266 module. Using the 3.3v- and GND pins. Can’t remember if I tried powering the module with 5v instead ?

Alternatively, you could try powering the RS485 module with an external power supply and not via the ESP8266 device (if you’re not already doing that). If you’re using the mentioned ESPMB module I guess power to both ESP and RS485 module is ok and not the issue.

I don’t believe that it’s a software (request syntax) related issue you have, more likely a hardware issue of some sort. But just to eliminate this, try and replace the request for a complete package with a serial number request instead.

- uart.write: [0x02, 0x05, 0x01, 0x02, 0x00, 0x01, 0xAD, 0xFC, 0x03]

Completely forgot that you’re using a G3 inverter. My best guess is that your package length isn’t 255 bytes but the ‘common’ 157 bytes.

When you’ll get some data in, I’ll be able to help you tweak the code to match your package length and/or revise registers if needed (haven’t checked the datasheet yet)

Hi Henning,

Again, thank you for the effort to help. The RX led is flashing so rapidly that it is almost continuously lit. I now also connected GND (blue wire (4) from data cable), to no avail.
The module is fed by 5V external, see link in my first post for the assembly of the module.
No data coming in still. I will try to get hold of another module.
My module from the top looks exactly like the non-functional module you mention in your thread (XY-017), the bottom part is obscured by the assembly board.
I will start a new thread when I have set up the new module and have some data to show.
By the way, Mark (it-koncept) used G3. His code is not much different?
I will also continue to experiment with the waveshare unit mentioned earlier with the Modbus nodes in node red.
Any idea how to translate these hex adresses/registers shown in the live package example to decimal. I suppose these are holding registers.
All over the internet, it is mentioned that modbus is so simple to implement and therefore so widespread. But Delta seems to be some special case.
Thanks again.

Kind regards,

Jaap

You’re welcome :slight_smile:

The +5v feed might be an issue as I guess that the TTL level will be identical with the VCC input ? ESP’s are not really 5v tolerant on input pins (but it might work anyway). Try feeding the RS485 module with +3.3v and see if that makes any difference.

The Dollatek module version (Marked ‘RS485 to TTL’ on the pcb backside) works with my Solivia inverter. Try and grab an identical module. Both available via AliExpress, Amazon, Ebay etc.

The package length varies between the different Solivia inverter variants. So the ESPHome custom code must be tweaked to match the package length. My code checks for a specific length and rejects packages that doesn’t match. Still not the issue as any inbound package should be visible in the debug log.

The idea with the package request is that you get all relevant data in one request. Package content is indeed various holding registers, but the positions within the package vary a lot between the different inverter variants. You can use any online hex to dec converter to converts register values into decimal values. Check my live package example and test yourself with some of the register values.

Marks custom code varies quite a lot from mine. It’s in that code the package is ‘handled’ and the specific registers offset values are specified. The yaml part doesn’t vary a lot though.

Modbus IS simple - Once you get it going :slight_smile: