Integrating SRNE MPPT Inverter with HA

So I was looking for a way to get data from my SRNE Solar charge inverter. And after looking into some bluetooth adapters and different modbus configurations I decided to give it a shot. I have never looked into modbus before but after reading this thread I ordered a waveshare RS485 to ethernet adapter from amazon.

The hardest part was to understand the dataflow and after that it was pretty much downhill.

I got the modbus address translations in a pdf from the company who responds very fast! Then just insert the adresses in a hex to decimal converter and paste it in a modbus sensor.

For my inverter the rs485 port was an exact copy of an rj45 port and it needed the pin 7 and 8 from a regular network cable. EDIT. 7 (brown) is B- and 8 is A- (brown/white). So just cut a cable and get those into the waveshare unit.

after that follow the guide from the thread above where the gatewaysettings are described then if you happen to use a 3kWh SRNE device find the code below!

Mabye it helps someone out there :slight_smile:

SRNE 3000W 24V
image

Waveshare RS485 to ethernet

#################################################################################################################################
#                                   MODBUS
#################################################################################################################################

modbus:
  - name: modbus_tcp
    type: rtuovertcp
    host: 192.168.1.30
    port: 8888
    sensors:
#Load active power phase A
      - name: Modbus_Inverter_Power
        unit_of_measurement: W
        scale: 1
        slave: 1
        address: 539
        input_type: holding
        
#Battery level percentage
      - name: Modbus_Inverter_BatteryLevel
        unit_of_measurement: '%'
        scale: 1
        slave: 1
        address: 256
        input_type: holding

#Last equalizing charge completion time
      - name: Modbus_Inverter_BatteryLastEqualization
        scale: 1
        slave: 1
        address: 61507
        input_type: holding


#Battery voltage
      - name: Modbus_Inverter_BatteryV
        unit_of_measurement: V
        scale: 0.1
        precision: 1
        slave: 1
        address: 257
        input_type: holding
        
#PV panel 1 voltage 
      - name: Modbus_Inverter_PV_voltage
        unit_of_measurement: V
        scale: 0.1
        precision: 1
        slave: 1
        address: 263
        input_type: holding
        
#PV panel 1 current 
      - name: Modbus_Inverter_PV_current
        unit_of_measurement: A
        scale: 0.1
        precision: 1
        slave: 1
        address: 264
        input_type: holding
        
#PV panel 1 power
      - name: Modbus_Inverter_PV_power
        unit_of_measurement: W
        scale: 1
        slave: 1
        address: 265
        input_type: holding
        
#Total charge power, include charge power by mains and pv
      - name: Modbus_Inverter_Charge_power
        unit_of_measurement: W
        scale: 1
        slave: 1
        address: 270
        input_type: holding
        
#Charge state
      - name: Modbus_Inverter_battery_chargestate
        scale: 1
        slave: 1
        address: 267
        input_type: holding

#Current state of the machine
      - name: Modbus_Inverter_Operation
        scale: 1
        slave: 1
        address: 528
        input_type: holding

#Load side current phase A
      - name: Modbus_Inverter_current
        unit_of_measurement: A
        scale: 0.1
        precision: 1
        slave: 1
        address: 537
        input_type: holding
        
#Battery side current when charging on mains
      - name: Modbus_Inverter_Main_charge_current
        unit_of_measurement: A
        scale: 0.1
        precision: 1
        slave: 1
        address: 542
        input_type: holding
        
#Battery side current by PV charging
      - name: Modbus_Inverter_PV_charge_current
        unit_of_measurement: A
        scale: 0.1
        precision: 1
        slave: 1
        address: 548
        input_type: holding

#The total PV power generation of the day, applicable to the 2nd generation machines
      - name: Modbus_Inverter_pv_daily_consumption
        unit_of_measurement: kWh
        scale: 0.1
        precision: 1
        slave: 1
        address: 61487
        input_type: holding

#The total battery charge level (AH) of the day
      - name: Modbus_Inverter_battery_charge_daily
        unit_of_measurement: Ah
        scale: 1
        slave: 1
        address: 61485
        input_type: holding

#The total battery discharge level (AH) of the day
      - name: Modbus_Inverter_battery_discharge_daily
        unit_of_measurement: Ah
        scale: 1
        slave: 1
        address: 61486
        input_type: holding

#The total PV power generation of the day
      - name: Modbus_Inverter_pv_daily_consumption
        unit_of_measurement: kWh
        scale: 0.1
        precision: 1
        slave: 1
        address: 61487
        input_type: holding

#The total power consumption by load of the day
      - name: Modbus_Inverter_load_daily_consumption
        unit_of_measurement: kWh
        scale: 0.1
        precision: 1
        slave: 1
        address: 61485
        input_type: holding
        
#Total running days
      - name: Modbus_Inverter_uptime
        unit_of_measurement: days
        scale: 1
        slave: 1
        address: 61489
        input_type: holding
 
#Accumulated PV power generation
      - name: Modbus_Inverter_PV_Generated
        unit_of_measurement: kWh
        state_class: total_increasing
        scale: 0.1
        precision: 1
        slave: 1
        address: 61496
        input_type: holding
 
#Power consumption by load from mains of today
      - name: Modbus_Inverter_Main_load_power_daily
        unit_of_measurement: kWh
        scale: 0.1
        precision: 1
        slave: 1
        address: 61501
        input_type: holding

#DC-DC heat sink temperature
      - name: Modbus_Inverter_DCDC_temp
        unit_of_measurement: '°C'
        scale: 0.1
        precision: 1
        slave: 1
        address: 544
        input_type: holding

#DC-AC heat sink temperature
      - name: Modbus_Inverter_DCAC_temp
        unit_of_measurement: '°C'
        scale: 0.1
        precision: 1
        slave: 1
        address: 545
        input_type: holding

#Translator heat sink tmperature
      - name: Modbus_Inverter_translator_temp
        unit_of_measurement: '°C'
        scale: 0.1
        precision: 1
        slave: 1
        address: 546
        input_type: holding
        
#Load percentage phase A
      - name: Modbus_Inverter_LoadRatio
        unit_of_measurement: '%'
        scale: 1
        slave: 1
        address: 543
        input_type: holding

More helpful links:

Latest dashboard:

5 Likes

Just what I was looking for. Thanks.
Have you tried to write a register for example you want to change the charging mode? Any ideas how to do it?

No but I have thaught about it, just not had the time yet. feel free to update here if you get there first :slight_smile:

Some collected data (missing the sun!)


Hi Mattie,

I have exact same inverter but i am unable to get data. I am not sure if it is my setting are okay cos i am getting input/output errors. Can you help

MY SERIAL SETTING

CONNECTION LOG

That is not a waveshare gateway is it? As long as you follow the settings I’ve used it should work. Check out this thread Modbus TCP Gateway Recommendation

Also there are plenty of programs to poll different addresses and try it out, I think one of them is called modpoll.

It is not a waveshare gateway. I use Elfin ew11 as my gateway. I have been using it for my old epever charge controller and it works fine.

I have also connected to this SRNE inverter via USB and I can pull data but it frequently gives an erro5 input/output error which requires me to restart HA several times a day. This is why I want to switch to ethernet.

When i had this issue on my previous inverter I switch rx and tx wires and it was okay but that is not working now. I am not sure what else to check.

I have solved the problem. In modbus config, I previously had type as rtuovertcp. Now I changed it to TCP.

Nicely done, my next project will be to send commands to the inverter. I need to control when it charges the batterybank. The plan is to control setting 6 which is charging mode if I remember correct.

So I tried writing some registers and it turned out to be very easy, I made scripts that look like this:

service: modbus.write_register
data:
  address: 57871
  value: 2
  hub: modbus_tcp

I’m pretty happy with the dash so far :slight_smile: Nevermind the failed tempsensor in my batterybank

2 Likes

How is your experience with your gateway? I’m getting failed readings for every sensor pretty often. Every few seconds each sensor gives the state “unavailable” and I wonder if its my gateway that causes this, or is it the inverter?

Also when the inverter starts getting solar power it feels like the readings are getting ridiculously slow. Almost as if the inverter CPU cant manage or so. When I try to write a register at night it writes it instantly but when I try it when the sun is out and when the inverter is inverting power I can almost not get it to write at all. Im having to spam the setting and sometimes the registry is written a few minutes later or so

What scan interval are you using? I read data every minute. I also grouped addresses together so that I have less number of query to the inverter. It seems you have several or all of your requests going to the inverter same time.

I observed that the Chinese wifi module sold along with this inverter (on Aliexpress) reads every 5 minutes so I figured they don’t want to overload the inverter. One-minute interval, however, seems to work for me for at least one week before requiring a restart of HA.

Thanks for the info, I was polling every 2 seconds! I noticed warnings in the log that said lower than 5 seconds could cause instability issues which is what I experienced in ha, it could randomly restart. I changed to 5 secs yesterday and it feels much better already.

Haven’t checked out grouping att all, maybe it’s worth looking into?

1 Like

Mine looks like this

modbus:
- type: tcp
  name: SRNE
  host: 192.168.x.x
  port: 502
  close_comm_on_error: false
  timeout: 14
  retry_on_empty: true
  retries: 10
  sensors: 
    - name: "Main Battery"
      address: 256
      slave: 255
      count: 3
      scan_interval: 60
      data_type: custom
      structure: ">3H"
    - name: "Main Panel"
      address: 263
      slave: 255
      count: 3
      scan_interval: 61
      data_type: custom
      structure: ">3H"
    - name: "Main Usage"
      address: 61487
      slave: 255
      count: 2
      scan_interval: 3600
      data_type: custom
      structure: ">2H"
    - name: "Main Load"
      address: 540
      slave: 255
      count: 4
      scan_interval: 62
      data_type: custom
      structure: ">4h"
#Power consumption by load from mains of today
    - name: Inverter_Main_load_power_daily
      unit_of_measurement: kWh
      scale: 0.1
      precision: 1
      slave: 255
      address: 61501
      input_type: holding
      scan_interval: 63
#Charge state
    - name: Load and charge state
      scale: 1
      slave: 255
      address: 267
      input_type: holding
      scan_interval: 60
#Current state of the machine
    - name: Inverter State
      scale: 1
      slave: 255
      address: 528
      input_type: holding
      scan_interval: 60

sensor:
  - platform: template
    sensors:
##SRNEInverter
      main_battery_soc:
        friendly_name: "Main Battery SOC"
        unit_of_measurement: '%'
        value_template: "{{ (states('sensor.main_battery').split(',')[0])  }}"
      main_battery_voltage:
        friendly_name: "Main Battery Voltage"
        unit_of_measurement: V
        value_template: "{{ (states('sensor.main_battery').split(',')[1]|float * 0.1)|round(1)  }}"
      main_battery_current:
        friendly_name: "Main Battery Current"
        unit_of_measurement: A
        value_template: "{{ (states('sensor.main_battery').split(',')[2]|float * 0.1)|round(1)  }}"
      main_panel_voltage:
        friendly_name: "Main Panel Voltage"
        unit_of_measurement: V
        value_template: "{{ (states('sensor.main_panel').split(',')[0]|float * 0.1)|round(1)  }}"
      main_panel_current:
        friendly_name: "Main Panel Current"
        unit_of_measurement: A
        value_template: "{{ (states('sensor.main_panel').split(',')[1]|float * 0.1)|round(1)  }}"
      main_panel_power:
        friendly_name: 'Main Panel Power'
        unit_of_measurement: W
        value_template: "{{ (states('sensor.main_panel').split(',')[2])  }}"
      main_power_generated:
        friendly_name: "Main Power Generated"
        device_class: energy
        #state_class: total_increasing
        unit_of_measurement: kWh
        value_template: "{{ (states('sensor.main_usage').split(',')[0]|float * 0.1)|round(1)  }}"
      main_power_consumed:
        friendly_name: "Main Power Consumed"
        device_class: energy
        #state_class: total_increasing
        unit_of_measurement: kWh
        value_template: "{{ (states('sensor.main_usage').split(',')[1]|float * 0.1)|round(1)  }}"
      main_load_power:
        friendly_name: "Main Load Power"
        unit_of_measurement: W
        value_template: "{{ (states('sensor.main_load').split(',')[0])  }}"
      main_load_percent:
        friendly_name: "Main Load Percentage"
        unit_of_measurement: '%'
        value_template: "{{ (states('sensor.main_load').split(',')[3])  }}"
      main_inverter_state:
        friendly_name: "Main Inverter State"        
        value_template: >-
          {% if states('sensor.inverter_state') | int == 4 %}
          Mains Powered
          {% elif states('sensor.inverter_state') | int == 5 %}
          Inverter Powered
          {% elif states('sensor.inverter_state') | int == 6 %}
          Inverter to Mains
          {% elif states('sensor.inverter_state') | int == 7 %}
          Mains to Inverter
          {% endif %}
      main_load_charge_state:
        friendly_name: "Main Charge State"        
        value_template: >-
          {% if states('sensor.load_and_charge_state') | int == 0 %}
          Not Charging
          {% elif states('sensor.load_and_charge_state') | int == 1 %}
          Start Charge
          {% elif states('sensor.load_and_charge_state') | int == 2 %}
          MPPT Charging
          {% elif states('sensor.load_and_charge_state') | int == 3 %}
          Equalizing Charging
          {% elif states('sensor.load_and_charge_state') | int == 4 %}
          Boost Charging
          {% elif states('sensor.load_and_charge_state') | int == 5 %}
          Floating Charging
          {% endif %}

Great stuff! We have some dissimilarities that I will dissect later today. What does the split in your template sensors do?

When you group the read request, the values will come in comma-separated. Split is used to separate them into individual items.

Ah that is way smarter indeed, I think I will copy that :slight_smile:

What do you think of the current measurement from the PV panels? Do you trust it? I have a 4 panels wired in 2s2p, but I feel that I dont get the amps out from the array, the first series string is 2 x 7.75A and the second is 2 x 12.6A so it should be a bit above 20A totally when paralleled… but I never got more than 8A as measurement via modbus. But today I noticed that the physical display on the inverter showed a higher amp number than the modbus reported. I wonder why that is…? I have the same address as you for the PV amps (264)

Seems that you live in a sunnier place than me at least (sweden) :slight_smile:

Yes I live in a very sunny part of the world but I also think my panels are producing less than should be. My technician tells me otherwise.

My panel voltage and power reading are quite accurate. I cannot tell about the battery reading since they don’t show on the inverter itself. I do have a Chinese wifi plug made for SRNE hybrid inverter and their reading is similar to mine on HA.

Okay, We will see when the summer comes, I installed a bigger battery system and noticed that the solar gave more power than usual, maybe I didn’t have enough power consumers before so my bigger bank has room for all solar now. I can get voltage, current and calculate the power. Even the kwh in the energy dashboard is working now. :ok_hand:

Hi guys.
This is my first post here, previously I was just reading and for now I don’t have any problems with HA. Now I force with a wall.
I got this inverter 5000W Hybrid Solar Inverter High Voltage HF4850S80-H - SRNE Solar and RS485 to Ethernet Converter by waveshare.
In first post I found a mistake with wiring, pin 7 should go to A (light brown), pin 8 should go to 8 (brown).
https://dekornik.com/wp-content/uploads/2023/02/308e1d09-9ede-43ea-abf9-bb12cce60042.jpg
but after connecting I still has no data

Module Name: RS485 TO ETH
Current IP Address: 192.168.2.224
MAC Address: d4-ad-20-4b-72-42
Remote IP/TX/RX-1 : 0.0.0.0 / 0 byte / 0 byte
-2 : 0.0.0.0/ 0 byte / 0 byte
-3 : 0.0.0.0/ 0 byte / 0 byte
-4 : 0.0.0.0/ 0 byte / 0 byte
-5 : 0.0.0.0/ 0 byte / 0 byte
TX Count/RX Count: 0/ 144 bytes

Waveshare is configured exactly like in screenshots and I try this modbus yml

modbus:

  • name: modbus_tcp
    type: rtuovertcp
    host: 192.168.2.224
    port: 8888
    sensors:
    #Battery level percentage
    • name: Modbus_Inverter_BatteryLevel
      unit_of_measurement: ‘%’
      scale: 1
      slave: 1
      address: 256
      scan_interval: 60
      input_type: holding