Logging SolarEdge inverter data using MODBUS over TCP

Works in Teh Playground! too…

echo $val = 3281977341 >> 16;
50078

The docs say the I_AC_Frequency register and the I_AC_Frequency_SF register hold 16-bit values.

The line you pointed out

appears to be expecting a 32-bit value. (why else would you shift it 16 bits to the right?)

That’s not going to produce the correct results.

Hi Bill, you are correct but when we pull the data from 40086 we pull 2 registers 40086 & 40087 into one unsigned 32bit integer hence the number 3281977341.

This method is working for other values but not the frequency and I just dont understand why

40086 is the zero based address for the I_AC_Frequency_SF register. i.e. it’s not the LSW.
If your data retreival code is zero-based, you’re pulling data from two unrelated registers.
(I_AC_Frequency_SF and I_AC_VA)

You shouldn’t have to do anything with any of the scaling factors. They don’t change unless the values in their registers change. According to the doc file you posted, all of the values you’re interested in retreiving are 16-bit values. i.e. if you’re combining them into 32-bit integers, that part of your code needs fixing too.

I’m lost, well you knew that!

I can pull registers 40086 and 40087 separately and get the numbers I expect.

Are you up to speed on what is meant by zero-based vice one-based?

You shouldn’t need to retreive the Scale Factor. Once the correct value is written into the SF
register, that’s all that needs to be done with the SF. It tells the inverter to give you the data
properly scaled. It shouldn’t change until a new value is written into the SF register, and that
should happen only if/when you do so.

Obviously not

OK. NOT a problem. We were all newbies at one time. :wink: :grin:

Zero based simply means you start counting from zero.

0, 1, 2, 3, 4
Five items. The list starts at zero.


One-based means you start counting at one.
1, 2, 3, 4, 5
Five items here too, but the list starts at one.

What appears to be happening is your code is retreiving data from the frequency scale factor
register as well as the apparent power register.

All you need is the data from the AC Frequency register, i.e. you don’t need to combine it with anything
else, which also means it doesn’t need to be shifted.

If that’s indeed the case, the frequency register address you’ll want to use is 40085.
Otherwise, you’ll use address 40086

Retreiving the data by reading registers one at a time shouldn’t be a problem.

JustinKnight, is this the right firmware upgrade file please - CPU_3_2537_3_2618.bsuf

Hi Aidan,
sorry I don’t remember, it was almost a year ago I upgraded ours. I would have used whatever the latest firmware version was at the time (Late December 2020). I would check the solaredge website: Firmware Updates for Inverters with Display | SolarEdge and if you’re not certain which is the correct firmware for your inverter contact their support to confirm.

Justin.

Justin, thanks - Ethernet would not DHCP after I attempted the update - setting static IP seems to have sorted it. I also now realise I was not following update process correctly… may try again

Hello,

I’m very sorry to bump an old thread! I’ve just had a Solaredge system fitted (its one of the new generation HD Wave inverters with no screen). I’ve been trying to use the code in this thread to pull data into my emonpi with no success!

I got the installer (with much bemused looks!) to enable both the MODBUS over Ethernet option, and also set one of the RS485 ports to NonSE monitoring as you can’t fiddle with any of the settings without the engineers SetApp application (and password!) on this version.

I’ve checked the right IP, and used port 1502 (as well as 502 in the original code) and persistently get

2022-01-24 12:00:09,262 INFO ModbusTCP Not connected, retrying connect {‘modbus_IP’: ‘192.168.1.207’, ‘modbus_port’: ‘1502’}
2022-01-24 12:00:09,276 DEBUG ModbusTCP Connection failed
2022-01-24 12:00:10,378 INFO ModbusTCP Not connected, retrying connect {‘modbus_IP’: ‘192.168.1.207’, ‘modbus_port’: ‘1502’}
2022-01-24 12:00:10,392 DEBUG ModbusTCP Connection failed

I’ve power cycled the inverter after each change noting the need to read the data within 2 minutes, to no avail.

I’ve also tried using an RS485/USB directly into emonpi and hacked something crude by starting off with Type = EmonHubMinimalModbusInterfacer but that appeared to do nothing too, and to be honest I’m out of my depth!

I’m mainly trying to read the data direct from the inverter so I can free up the CT to monitor the battery power.

If anyone could offer me any advice I’d be most grateful…

Richard

Hello Richard,
sorry I don’t think I can offer much help, sounds like you’ve tried all the sensible troubleshooting steps.
A couple of thoughts:-

  • Assuming your inverter has a LAN connection via Wifi to your router worth checking that the inverter is showing up as a connected device in the router’s connected devices list.
  • If the inverter is connecting to the router over DHCP then it’s IP address might change on each power cycle.
  • Sounds like your installer wasn’t familiar with ModBUS over Ethernet and didn’t set-up correctly, maybe speak to them again or try contacting solaredge support direct.

Annoying that you don’t have a screen on your inverter to check and change settings. Good luck!

Kind regards,
Justin.

Hello,

It was set up with wifi, but its right next door to the router, and I fitted a direct ethernet cable between it, as the solar edge info is unclear whether it will transmit the data via the wifi connection - but either way the IP does change occasionally.

The installer didn’t have a clue really (and didn’t seem to understand what/why I wanted stuff changing, and just gave me his phone with the SetApp app on and told me to change what I wanted!

I’ll keep fiddling and see what happens…

Hello, I’m back with more stupid questions!

I’ve got the data coming in now at last - no idea what I did differently other than keep trying! I did manage to read some data via RS485 into my laptop using a MODBUS reader application, but I couldn’t get anything to show with emonpi - so went back to using ethernet and its working happily now!

I’ve used the code in post 1 and not yet tried to do anything clever reading two registers at once - I just wanted to prove I could get data flowing in first!

Anyway - next plea for help is some guidance on what I need to modify and where/how to add the bits of code @justinknight added in post 3 to actually decode into ‘real’ values. Do I need to worry about the issue with reading the scale factor and value at different times? :thinking: It’s all a bit out of my depth now!

Thank you for any advice…

Hello Richard!
awesome, glad you managed to read some data over ethernet.

My changed code in this pull request… https://github.com/emoncms/emoncms/pull/1647
…creates two new processes.

One is called “pow10 input” which multiplies one input times ten to the power of another - this is the basic solution, which occasionally causes the odd spike in the data when the value from one point in time is applied to the scale factor from another.

The second is “value and scale” which is what I’m using now which unpacks a 32 bit integer of the combined value and scale into two 16 bit integers and then scales the value in the same way. Using this should avoid the occasional spikes in the data mentioned earlier.

To apply the code changes to your emonpi you would need to ssh/sftp into your emonpi, find this file (backup original first in case you want to go back easily):
Modules/process/process_processlist.php
Then apply the changes outlined here: https://github.com/emoncms/emoncms/pull/1647/files

Might need to reload page / restart processes or pi itself to pick up the changes, after which you should see the two new processes.

Kind regards,
Justin.

Thank you! I’ll have a go and report back :grinning:

Can’t find the folder path once I SFTP into the server, do you have the full path for it?

I’m sorry to keep asking dumb questions - but I’m at a total loss as to how I even find the right file to edit :neutral_face:

I can get into the pi with dataplicity or terminal (Mac) but I’m clearly not googling the right things to help me get started… can anyone point me in the right direction of an idiots guide where to get started….?

Thank you