Integrating SRNE MPPT Inverter with HA

Double check your connections/cables with the manual. Try some other Windows software like modpoll for these registers and see if you get some values. Also check if your values are in decimal or hex form. They should be in decimal form in ha config if I remember correctly. Those are my best tips I’m afraid

Mattie you are an absolute legend.

Thanks to you I got my system working the way I want. It is a small 1kwh solar system from a balcony in Tokyo. As you might expect shading is a problem, also my apartment is a rental on the 3rd floor in a country that has frequent earthquakes and Typhoons(Or Hurricanes as they are called in the northern hemisphere) So I am rather limited. Also it is not exactly normal in Japan to install anything on your balcony other that laundry lol. In Japan the power companies also have ratio plans depending on grid loads and so having a battery alone can quickly make a difference if you charge at the right times.

That’s great to hear man! I’m glad you’re happy :smiley: Also an excellent situation to use solar in as I understand it. Check if you’re allowed to build something that holds your panels outide the balcony maybe lol (for the shading). Need to watch out for those hurricanes tho!

1 Like

@Mattie thank you for this work! I got an HF4850S80-H type of inverter that I have been controlling with my own bash/python integration by reverse engineering the commands I received from the supplied manufacturer software iPower.exe.

Can you share any documentation about the registers you use? How did you find/acquire this documentation?

I created the below script to configure values, but I would like to expand this to all the battery settings, have you done this with modbus and any mapping between the configuration settings in the manual and the modbus commands?

Is there a way to configure the modbus and intervals, so it does not lock up the tcp connection the port all the time as it prevents my script to run and then my automation fails with writing my settings.

Has anyone found documentation about temperature monitoring and maximum temperatures?
Has anyone found firmware updates for your devices? HF4850S80-H (with parallel communication).

#!/bin/bash -x


apk add sed socat xxd python3 -q

decimal_to_modbus_hex() {
    local decimal=$1
    local high_byte=$((decimal / 256))
    local low_byte=$((decimal % 256))
    printf "%02X %02X\n" "$high_byte" "$low_byte"

modbus_hex_to_decimal() {
    local hex="$1"
    local high_byte="0x${hex%% *}"  # Extract the high byte
    local low_byte="0x${hex##* }"   # Extract the low byte
    local decimal=$(( (high_byte * 256) + low_byte ))  # Calculate the decimal value
    echo "$decimal"

     OUTPUT_PV_FIRST="01 10 e2 04 00 01 02 00 00 65 da"
   OUTPUT_MAIN_FIRST="01 10 e2 04 00 01 02 00 01 a4 1a"
OUTPUT_BATTERY_FIRST="01 10 e2 04 00 01 02 00 02 e4 1b"
       OUTPUT_STATUS="01 03 e2 04 00 01 f3 b3"
       OUTPUT_RETURN="01 10 e2 04 00 01 76 70"

    CHARGER_PV_FIRST="01 10 e2 0f 00 01 02 00 00 64 a1"
  CHARGER_MAIN_FIRST="01 10 e2 0f 00 01 02 00 01 a5 61"
 CHARGER_PV_AND_MAIN="01 10 e2 0f 00 01 02 00 02 e5 60"
     CHARGER_ONLY_PV="01 10 e2 0f 00 01 02 00 03 24 a0"
      CHARGER_STATUS="01 03 e2 0f 00 01 82 71"
      CHARGER_RETURN="01 10 e2 0f 00 01 07 b2"

 SAVING_POWER_ENABLE="01 10 e2 0c 00 01 02 00 01 a5 52"
SAVING_POWER_DISABLE="01 10 e2 0c 00 01 02 00 00 64 92"
 SAVING_POWER_STATUS="01 03 e2 0c 00 01 72 71"
       SAVING_RETURN="01 10 e2 0c 00 01"

VALUE=$((VALUE * 10))
VALUE=$(decimal_to_modbus_hex "$VALUE")
  CURRENT_AC_CHARGER="01 10 e2 05 00 01 02 $VALUE"
CRC=$(python3 /config/ "$CURRENT_AC_CHARGER")
#CRC=$(python3 /usr/local/bin/ "$CURRENT_AC_CHARGER")
   CURRENT_AC_STATUS="01 03 e2 05 00 01 a2 73"
      CURRENT_RETURN="01 10 e2 05 00 01"
	 BATTERY_SOC="01 03 01 00 00 0f 04 32"
      BATTERY_RETURN="01 03 1e"

     AMPERAGE_STATUS="01 03 e2 05 00 01 a2 73"
     AMPERAGE_RETURN="01 03 02"

RETURN="$(echo $INPUT | cut -f 1 -d "_")_RETURN"

COMMAND=$(echo "$COMMAND" | sed 's/[[:blank:]]//g')
RETURN=$(echo "$RETURN" | sed 's/[[:blank:]]//g')

while [[ "$RESPONSE" != *"$RETURN"* ]]; do
    RESPONSE=$(echo -n $COMMAND | xxd -r -p | socat -t 1 -b 9600 TCP-CONNECT: STDIO | xxd -ps -c 256)
    sleep 1

#if [ "$INPUT" == "BATTERY_SOC" ]; then
#    RESPONSE=$(echo "$RESPONSE" | sed "s/.*$RETURN/$RETURN/")
#    #RESPONSE=$(echo "$RESPONSE" | awk -F "$RETURN" '{print $2}')
#    # battery state of charge field five
#    # hexSOC=$(echo $RETURN$RESPONSE | head -c 10 | tail -c 2)
#    hexSOC=$(echo $RESPONSE | head -c 10 | tail -c 2)
#    SOC=$(( 16#$hexSOC ))
#    echo $SOC

if [ "$INPUT" == "AMPERAGE_STATUS" ] || [ "$INPUT" == "BATTERY_SOC" ]; then
    RESPONSE=$(echo "$RESPONSE" | sed "s/.*$RETURN/$RETURN/")
    # data can be found in field five
    hexDATA=$(echo $RESPONSE | head -c 10 | tail -c 4 | sed 's/../& /g; s/ $//')
    DATA=$(modbus_hex_to_decimal "$hexDATA")
    echo $DATA


Hi! I’m glad to hear that :slight_smile: I will post some docs on the modbus indexes here instead of uploading it when I get to the computer. You can set the scan intervals in the modbus configuration if that’s an alternative for you. I don’t know if you can poll it manually. An easy work around would be to control the modbus gateway with a zwave switch or something like that. Depending on what you wish for it could work. And if you only wish to send commands (write registers) through the gateway it can be done with scripts so that you don’t need to poll at all.

1 Like

Would it be possible to write the registers with the same modbus connection used to read the sensors, then I can replace my custom script with writing to sensors etc. Have you done this with HA modbus and any mapping/documentation between the configuration settings in the manual and the modbus commands?

I guess that should be doable if you just copy the modbus config without the “sensors:” part if you dont want any. Then try to make a script like I made in this post: Integrating SRNE MPPT Inverter with HA - #10 by Mattie worked nicely for me

I am new to the Home Assistant. Recently I just try to setup the modbus with USB(rs485 to USB with CH340T) for my SRNE 48V 5000W all in one inverter. Currently I can read all the data with modbus sensor as Entities, but they are not listed and HA complain no unique_ID. I try to manually add some unique_ID as your configuration.yaml, I still can’t use them in the energy dashboard even with right kWh unit. Your dashboard looks so good, I want to setup it up as yours. Would you tell me how you integrate these modbus sensors into Home Assistant and Dashboard?

Sorry to Hijack this thread…

I am working on supporting the Japanese specific SolaX Hybrid Inverter J1 into my custom_integration Universal Solar Inverter over Modbus RS485 / TCP custom_component (Growatt, Sofar, SolaX, Solis)

By any chance do you know anyone in Japan who owns one?

Also is there any benefit to you all if I added SRNE into my custom_integration if it makes it easier to install / keep upto date etc? Assuming there are adequate Modbus docs available.

1 Like

Hello my friend, I dont know about the device you are using, easiest way for you is to buy the part I used in the guide and just follow the steps above. Also for the graphs I export data to influxDB, its a timeseries database that can show data over time better. For visualisation it uses grafana, then integrate that into your dashboard. It needs some reading to understand but is very powerful… :slight_smile:

For everyones use I uploaded the modbus-index-pdf to another filesharing site, I hope it stays there for longer than 30 days. I anyone else has some space feel free to share it here

Modbus index.pdf

1 Like

Shows as deleted?

New link here Valid 30 days


That one worked.

I have SRNE inverter. Can someone guide me how to connect it with Home Assistant through ESP32 ?

Just started to add in support for these SRNE Inverters into my custom_component.
It’s limited at the moment and I’ll carry on adding to it over the next few days. Unless someone wants to look how the registers are defined in the plugin_srne and submit a PR.

1 Like

I would gladly do it if I had the time but life doesnt allow it currently :confused:

offtopic, is anyone having issues with your sensors after latest update? Most of my values have went crazy after yesterdays update…!

see this thread: Anyone else having MODBUS issues?

Does anyone have this working over the Bluetooth adapter my solar is in a shed in the back yard not able to run network cable

Hi Mattie,

I’ve purchased this waveshare RS485 to ETH adapter and have pluged in the respective cables (Ground pin 2, B- pin 7, and A+ pin 8) and setup my baud rate and port to be the same as yours and used the modbus template you provided as an example but always get the error:

“Received 0 bytes, unpack error unpack requires a buffer of 2 bytes”

I can see in the Wareshare portal that the RX and TX values are going up:

But still nothing, I have the ASF48100S200-H inverter so very similar to yours.

Any tips or help would be appreciated, here is my HA yaml, I have modbus working with my victron gear no issues there. Just need to get this inverter communicating.


  • name: SRNEInverter
    type: rtuovertcp
    port: 8888

    #Battery level percentage
    • name: Modbus_Inverter_BatteryLevel
      scan_interval: 60
      unit_of_measurement: “%”
      slave: 1
      scale: 1
      address: 256
      unique_id: 700
      input_type: holding

You should get a state on Modbus_Inverter_BatteryLevel with my config. If you copied every setting it should be fine and it sounds like your ha ip is the one showing up in the waveshare gateway? So it’s collection something?

What does your modbus config look like?