EPEVER UPower-Hi modbus setting, if you need :)

If someone needs, here is config for UPower-Hi hybrid inverter device (I have model UP3000-HM5042).

You get following values from inverter. Also you can control UPower-Hi when to charge battery from grid.

modbus:
  - name: epever
    type: tcp
    host: 172.16.0.33
    port: 502
    timeout: 10
    close_comm_on_error: false
    retry_on_empty: true
    retries: 20
    sensors:
      # Utility
      - name: "Grid Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3500
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Grid Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3501
        input_type: input
        scale: 0.01
        precision: 2  
      - name: "Grid Power"
        unit_of_measurement: W
        slave: 4
        address: 0x3502
        input_type: input
        scale: 0.1
        precision: 0 
      - name: "Grid State"
        # 0:Normal, 1:Low input; 2:High input, 3: No connected
        slave: 4
        address: 0x3511
        input_type: input
      - name: "Grid Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x350F
        input_type: input
        scale: 0.01
        precision: 2 
      # PV Array
      - name: "PV Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3549
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "PV Current"
        unit_of_measurement: A
        slave: 4
        address: 0x354A
        input_type: input
        scale: 0.01
        precision: 2
      - name: "PV Power"
        unit_of_measurement: W
        slave: 4
        address: 0x354B
        input_type: input
        scale: 0.01
        precision: 2  
      - name: "PV Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x3557
        input_type: input
        scale: 0.01
        precision: 2 
      # Load
      - name: "Load Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3521
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Load Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3522
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "Load Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x3530
        input_type: input
        scale: 0.01
        precision: 2   
      # Battery
      - name: "Battery Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3580
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Battery Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3581
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "Battery Capacity"
        unit_of_measurement: "%"
        slave: 4
        address: 0x3586
        input_type: input
        scale: 1
      - name: "Battery Temp"
        unit_of_measurement: "°C"
        slave: 4
        address: 0x3512
        input_type: input
        scale: 0.01
      - name: "Battery State"
        # 0:Normal, 1:Overvoltage, 2:Undervoltage, 3:Undervoltage Disconnect, 4:Fault 
        slave: 4
        address: 0x3589
        input_type: input
      - name: "Charging Mode"
        slave: 4
        address: 0x9607
        input_type: holding
    switches:
      - name: "Charge from grid"
        address: 0x9607
        slave: 4
        write_type: holdings
        # 1:Solar Priority, 2:Utility & Solar, 3:Solar
        command_on: 0x2
        command_off: 0x3
    binary_sensors:
      - name: "Inverter Bypass"
        # 0:NoBypass, 1:Bypass 
        address: 2100
        slave: 4
        input_type: discrete_input
1 Like

Hi Can anyone assist, I have got this working with the listing above, however how do you handle the PV Power and Battery current these are both two registers long in the HI series and this will correctly read -327.68 and +327.67 but you need to read the High register as well for correct vales. I don’t know how to do this in HA I can’t get the following to work? with a count 2 ? any assistance? as PV power goes negative after 327.67 W?

  - name: "PV Power"
    unit_of_measurement: W
    slave: 4
    address: 0x354B
    count: 2
    input_type: input
    scale: 0.01
    precision: 2

@metnetdave No idea :slightly_smiling_face:

I have like in first post and it’s working fine for me. The PV power it’s always positive value, the battery current its positive when charging and negative when consuming it.

Here is how it works on my HA.
Today is normal December day here in Finland, not much PV :grin:
kuva

Battery is been charged (max value is 35.6A) from grid starting on midnight and stopped on 6AM, after that is consumed (max -20.9A)
kuva

This will be the case for any values + or - but below one register capacity i.e PV power less than 327.67 watts is fine but anything above will then show as negative as the second register comes into play and the 1st bit of the lower register is one making values show as negative. this is my output PV from this morning, PV can not go negative the negative values were peaks greater than 327.67 watts.

the Power is held in two registers Low 354B and High 354C these need to be combined to show the true values

Ok, then there is problem.

I have dig those values from perl script (which I have found from German FHEM forum). Script can be found here.

This particular PV power is there like below. Register value is i13643 and converted to hex it is 0x354B. But not sure what those len and unpack means… How good is your know perl skills? Actually there is also another perl script related to this and can be found here.

          "i13643" =>  {       'reading' => 'PVInputPower',
								  'expr' => '$val=($val/100)." W"',
                                   'len' => '2',
                                'unpack' => 'l>', 							  
                       },

Perhaps you need to check those data_types and swap and there is also two registers L and H, this one is example for the older UPower taken from this thread EPEVER Modbus RS-485 Config - #67 by dylan

    - name: "Solaire Watt L"
      unique_id: epever.solarwatt
      unit_of_measurement: W
      slave: 1
      address: 12546
      input_type: input
      data_type: int32
      scale: 0.01
      count: 2
      precision: 2
      swap: word
    - name: "Solaire Watt H"
      unique_id: epever.solarwatt2
      unit_of_measurement: kWh
      slave: 1
      address: 12547
      input_type: input
      data_type: int32
      scale: 0.01
      count: 2
      precision: 2
      swap: word

Maybe the len value from perl scripts means that it reads also next register like this example 12546&12547. But how to get one value from those two registers, I don’t know.

Check from docs https://www.home-assistant.io/integrations/modbus/

Let me know if you get it working.

I have tried

      - name: "PV Power"
        unit_of_measurement: W
        slave: 10
        address: 0x354B
        input_type: input
        data_type: int32
        scale: 0.01
        count: 2
        precision: 2
        swap: word

It has not failed, but it is dark now so i need a good sunny day to push my array to over 372 watts and i’ll let you know.

Thanks for your help

Good. If it doesn’t work, check link below, it’s explain swap in modbus

https://iotech.force.com/edgexpert/s/article/Byte-and-Word-Swapping-in-Modbus

@metnetdave Just checked rest of those registers and there was few missing those Low&High registers. Now I have added those and added also couple register more.

#EPever UPower-Hi + USB CH343 + mbusd
modbus:
  - name: epever
    type: tcp
    host: 172.16.0.33
    port: 502
    timeout: 10
    close_comm_on_error: false
    retry_on_empty: true
    retries: 20
    sensors:
      # Utility
      - name: "Grid Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3500
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Grid Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3501
        input_type: input
        scale: 0.01
        precision: 2  
      - name: "Grid Power"
        unit_of_measurement: W
        slave: 4
        address: 0x3502
        input_type: input
        scale: 0.1
        precision: 0
        data_type: int32
        swap: word
        count: 2
      - name: "Grid State"
        # 0:Normal, 1:Low input; 2:High input, 3: No connected
        slave: 4
        address: 0x3511
        input_type: input
      - name: "Grid Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x350F
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        swap: word
        count: 2
      # PV Array
      - name: "PV Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3549
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "PV Current"
        unit_of_measurement: A
        slave: 4
        address: 0x354A
        input_type: input
        scale: 0.01
        precision: 2
      - name: "PV Power"
        unit_of_measurement: W
        slave: 4
        address: 0x354B
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        swap: word
        count: 2
      - name: "PV Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x3557
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        swap: word
        count: 2
      # Load
      - name: "Load Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3521
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Load Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3522
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "Load Total"
        unit_of_measurement: kWh
        slave: 4
        address: 0x3530
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        swap: word
        count: 2
      # Battery
      - name: "Battery Voltage"
        unit_of_measurement: V
        slave: 4
        address: 0x3580
        input_type: input
        scale: 0.01
        precision: 2      
      - name: "Battery Current"
        unit_of_measurement: A
        slave: 4
        address: 0x3581
        input_type: input
        scale: 0.01
        precision: 2   
      - name: "Battery Capacity"
        unit_of_measurement: "%"
        slave: 4
        address: 0x3586
        input_type: input
        scale: 1
      - name: "Battery Temp"
        #ElectricChrgBatteryTemp 
        unit_of_measurement: "°C"
        slave: 4
        address: 0x3512
        input_type: input
        scale: 0.01
      - name: "Battery State"
        # 0:Normal, 1:Overvoltage, 2:Undervoltage, 3:Undervoltage Disconnect, 4:Fault 
        slave: 4
        address: 0x3589
        input_type: input
      - name: "Charging Mode"
        # 1:Solar Priority, 2:Utility & Solar, 3:Solar
        slave: 4
        address: 0x9607
        input_type: holding
      - name: "Inverter Mode"
        # 0:Inverter priority, 1:Utility Priority
        slave: 4
        address: 0x9608
        input_type: holding
      - name: "Inverter Temp"
        #LoadHeatSink2Temp 
        unit_of_measurement: "°C"
        slave: 4
        address: 0x3533
        input_type: input
        scale: 0.01
    switches:
      - name: "Charge from grid"
        address: 0x9607
        slave: 4
        write_type: holdings
        # 1:Solar Priority, 2:Utility & Solar, 3:Solar
        command_on: 0x2
        command_off: 0x3
    binary_sensors:
      - name: "Inverter Bypass"
        # 0:NoBypass, 1:Bypass 
        address: 2100
        slave: 4
        input_type: discrete_input

1 Like

Great work. i have been unable to prove the Hi low register read the main one i have that goes over the single register value is PV power, however using the count 2 etc. it does not appear to have broken anything, we have just not had the sun today to test…

A very grey day here!

Looks good for PV Power, still trying to work out Battery Current!

Nice :slightly_smiling_face: What kind of problem you have with Battery Current?

When I use the two registers i get silly readings, just reading the low appears to work, I presume its because i never see high current the maximum I see is about 25A. this graph shows how silly it got reading both registers.
Screenshot 2022-12-06 at 15.10.47

I think it use only low register. I have only low in use and my max is 34A when charging battery from grid and it shows it correctly.

Hi Timo have you tried to read bits to values in a single register for example:- from the below register having a display that tells you input voltage status from bits D14 and D15

or Bits D2 and D3 to show charging status?

Electricity 1 Charging Status
3511

D15~D14, 00 Normal input voltage, 01 Low input voltage, 02 High input voltage, 03 No connect to the input power, etc.
D13~D12, Output power 00-Light load, 01-Medium load, 02-Nominal load, 03- Overload
D11 Short circuit
D10 Hardware over-voltage
D9 Heat sink overheating
D8 abnormal output voltage
D7 Input over current
D6 Busbar under-voltage
D5 Busbar over-voltage
D4 Low temperature
D3~2 Charging status 00 No charging, 01 Float charging, 02 Boost charging, 03 Equalizing charging
D0. 1 Run, 0 Standby

Hi, can you give me a pointer to how i go about using your code? And what else i need to do to get the data from the upower hi to HA? What lead are you using? (im new to HA and finding it very hard to learn any of this stuff as information is very hard to find…).
Thanks :+1:

Hello,

Can you tell me little bit your current HA setup? Do run it on Raspberry Pi 4? Do you have wifi coverage where UPower HI is? Etc.

But basically there is 3 steps

  1. get HA to talk with UPower HI rs485 bus
  2. add rs485 config to HA config.yaml file
  3. create dashboard

For step 1, I think most easiest one is use older model Ebox-wifi-01 donge, just need rewiring, check https://community.home-assistant.io/t/epever-modbus-rs-485-config/214397/79

Step 2) I use File Editor this one

Step3) this is easiest, basically drag and drop

Thanks very much for the reply :blush:

I have HA running on a RPI 3b+, hopefully it will still work on this older version?.. I have gotten the rpi working over wifi instead of ethernet (im also hoping this also doesnt cause a problem…?) as it will be placed in a shed in the garden with wifi only access. The shed contains the inverter, and has 2.4g wifi coverage. The inverter is an epever upower HI - 3000 hm10022.

I have a lead that came witht the inverter - CC-USB-DB9(M)-150U-V1.0. - which i was able to connect to an old laptop successfully, but obviously that is no good for home assistant, that i know of.
Epever tells me that the wifi box does not work with the HI series, which im guessing is why you say it needs rewiring… Do you know if after rewiring i could capture all of the data, or is some not available? - (sorry, i have not read the thread that you linked to yet, will do in a mo). Do you personally use the old version of the wifi box, or have found another way altogether?

The rs485 config to be added to my yaml file, presumably that is the one in this thread above, do you know if i would have to edit parts of the code to suit my inverter? (as mine is version hm10022 vs your hm5042 - they are both in the same epever manual, so at a guess should be very similar). Or would i just be able to copy and paste without modifying at all? - im guessing i would just have to try and find out!?

Could i use the standard dashboard without creating a new one? - just for now… Would the data still be shown in a more basic way, but still be shown automatically?

(sorry for all the questions, i have literally just started with HA!) - i also have an esp32 that i got recently but again, im completely new to it and have not done any programming for over 23 years, back in the dos days lol! Thank you :+1:

RPI 3b+ should fine.

If you run HA on Home Assistant Operating System, it not have drivers for CC-USB-DB9(M)-150U-V1.0.

Because of that I have ~12 years old Atom industrial PC running Debian 11 and for it have build drivers to CC-USB-DB9(M)-150U-V1.0. Drivers you find here . This Debian also runs mbusd daemon. With this mbusd daemon HA can talk via rs485 bus to UPower HI.

All UPower HI series devices have same rs485 registers, so you can use directly my setup.

Maybe esp32 can be used, but I don’t own it so I no idea :grinning:

Thank you, i will try using the wifi box method, as this will be easier for me… Thanks for your time :+1::+1: