Solution: Reading Solax SK-SU5000(E) inverters & SDM630V2 Modbus Power Meters

next error :frowning:

sudo ./power_scraper.py
:0: UserWarning: You do not have a working installation of the service_identity module: ‘cannot import name ‘verify_ip_address’ from ‘service_identity.pyopenssl’ (/usr/lib/python3/dist-packages/service_identity/pyopenssl.py)’. Please install it from https://pypi.python.org/pypi/service_identity and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
Setting up EmonCMS
not connected
not connected
err [Failure instance: Traceback: <class ‘KeyError’>: ‘linked-batteries’
/usr/local/lib/python3.7/dist-packages/pymodbus/framer/socket_framer.py:181:_process
/usr/local/lib/python3.7/dist-packages/pymodbus/client/asynchronous/twisted/init.py:126:_handleResponse
/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py:460:callback
/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py:568:_startRunCallbacks
— —
/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py:654:_runCallbacks
/home/pi/PowerScraper/Inputs/SolaxModbus.py:198:solaxRegisterCallback
./power_scraper.py:58:outputActions
/home/pi/PowerScraper/Outputs/SolaxBatteryControl.py:209:send

Nope, it happened on all 3 machines. They were all running Manager 2.27 - so maybe it was a firmware bug? They did reflash properly over the network once upgraded to 2.31.

If the inverter is working, and getting “Inv EEPROM Fault”, you can follow the procedure I outlined to get the machine back online without having to reflash it.

I did notice that in the previous set of firmware, the inverter mis-reported “Inverter Power” when charging the batteries from the grid, reporting twice as much power draw than it should have. This is fixed in the latest set of firmware.

Hmm, you’re missing linked-batteries from the config, it should be in the sample.

I have listed in the config

[Solax-BatteryControl]
#source = “MainsMeter” # The data source for power consumption
linked-batteries = true # If set, all batteries charge/discharge at the same rate when trying to zero total power
timezone = “AEDT-10” # If set, always use this timezone for period calculations. This may be useful if your machine tracks daylight savings, but your energy provider does not

Odd, I didn’t make any changes in that area, your config does look correct though.

Did you keep a copy of your previous config? It might be worth doing a diff and seeing if any extraneous changes may be throwing off the parser.

I am not sure what is going on, I have removed the PowerScraper folder and git cloned a new copy from the server, created a new config file, If when i change the file to only have 1 inverter battery is currently at 95% I cannot get it to suppy the house load.

> # Enable this section to scrape the Wifi interface of Solax inverters
> #[Solax-Wifi]
> #poll_period = 10 # seconds
> #timeout = 5 # seconds
> #inverters = ['solax1-wifi', 'solax2-wifi', 'solax3-wifi']
> 
> # Enable this section to scrape the Modbus/TCP (Ethernet port) of Solax inverters
> [Solax-Modbus]
> poll_period = 10 # seconds
> timeout = 5 # seconds
> power_budget_avg_samples = 30 # The maximum number of samples to average power budget over
> installer_password = **12345** # The installer password for the inverter (same as used on the front panel), required if you want to use battery control
> inverter_power = 5000 # Limit the inverter power to this amount, required if you want to use battery control
> inverters = ['solax1']
> 
> # Enable this section to scrape Modbus/RTU (RS485) connected SDM630v2 energy meters
> #[SDM630Modbusv2]
> #poll_period = 1 # seconds
> #timeout = 1 # seconds
> #baud = 38400
> #parity = 'E'
> #stopbits = 1
> #ports = ["/dev/ttyMainsMeter"]
> 
> # Enable this section to output to EmonCMS
> [emoncms]
> timeout = 5 # seconds
> server = "**http://12345/emoncms**"
> api_key = "**12345**"
> 
> 
> # Enable these sections to control battery charge/discharge on Solax SK-SU5000E inverters
> # This does a number of things:
> # 1. Allows more than 2 time periods through the day
> # 2. Allows excess generation on 1 inverter to charge an inverter on another phase instead
> #    of feeding that energy back to the grid (requires your billing meter to simply sum
> #    usage across phases)
> # 3. Allows inverters to share loads larger than what a single battery can discharge at
> # 4. Allow grid charge up to a certain level (to allow enough energy stored to see you through
> #    peak times)
> 
> #[Solax-BatteryControl]
> #source = "MainsMeter"     # The data source for power consumption
> #linked-batteries = true   # If set, all batteries charge/discharge at the same rate when trying to zero total power
> #timezone = "AEDT-10" # If set, always use this timezone for period calculations. This may be useful if your machine tracks daylight savings, but your energy provider does not
> 
> # Defines the inverters that will participate
> [Solax-BatteryControl.Inverter.solax1] # First inverter
> phase = 1                          # Which phase the inverter is connected to, as seen by the power consumption meter
> single-phase-charge-limit = 2000   # If the charge rate is below this, aim to zero our own phase, if it's above, aim to zero total power
> single-phase-discharge-limit = 2000   # If the discharge rate is below this, aim to zero our own phase, if it's above, aim to zero total power
> max-power = 5000                   # Limit the inverter output to this value
> max-charge = 2000                  # Maximum battery charge rate in Watts
> max-discharge = 2000               # Maximum battery discharge rate in Watts
> grace-capacity = 5                # Percentage of total capacity at which to stop charging to reserve for absorbing power greater than inverter output
> grace-power-threshold = 4500       # Ignore the grace capacity if PV power is greater than this
> grace-charge-power = 500           # The amount of power to charge the battery at when in the grace period
> #[Solax-BatteryControl.Inverter.solax2]
> #phase = 2
> #single-phase-charge-limit = 1000
> #single-phase-discharge-limit = 1000
> #max-charge = 2000
> #max-discharge = 2000
> #[Solax-BatteryControl.Inverter.solax3]
> #phase = 3
> #single-phase-charge-limit = 1000
> #single-phase-discharge-limit = 1000
> #max-charge = 2000
> #max-discharge = 2000
> #grace-capacity = 0
> 
> # Define the time periods
> # Suitable for ActewAGL Time of Use plans in Canberra, Australia
> # Peak times are widened in case the time on the meter drifts
> #[Solax-BatteryControl.Period.MorningPeak]
> #start = "6:55:00"      # The start time of the period
> #end = "9:05:00"        # The end time of the period
> #min-charge = 20        # The minimum % charge left in the batteries. The inverter will not discharge lower than this in this period
> #grid-charge = false    # True to charge from the grid if the charge is less than min-charge
> #force-discharge = 2000 # If set, will force the battery to discharge at this rate
> #
> [Solax-BatteryControl.Period.DayShoulderGracePeriod] # Reserve grace capacity in this period
> start = "00:00:00"
> end = "23:59:00"
> min-charge = 10        # Once charged, we don't want the battery to drop below this to give us enough to get through the following peak period
> grid-charge = false
> grace = false
> prefer-battery = false   # Solar power should go to charging the battery if battery is below mininmum
> #
> #[Solax-BatteryControl.Period.DayShoulder] # No grace capacity, aim to have the batteries fully charged
> #start = "14:00:00"
> #end = "15:55:00"
> #min-charge = 30        # Once charged, we don't want the battery to drop below this to give us enough to get through the following peak period
> #grid-charge = false
> #grace = false
> #
> # Allow charging near the end of the shoulder period (if the batteries are less than 30%)
> #[Solax-BatteryControl.Period.DayShoulderGridCharge]
> #start = "15:55:00"
> #end = "16:55:00"
> #min-charge = 30
> #grid-charge = true
> #grace = false
> #
> #[Solax-BatteryControl.Period.EveningPeak]
> #start = "16:55:00"
> #end = "20:05:00"
> #min-charge = 20
> #grid-charge = false
> #grace = false
> #
> #[Solax-BatteryControl.Period.EveningShoulder]
> #start = "20:05:00"
> #end = "22:05:00"
> #min-charge = 20
> #grid-charge = false
> #grace = false
> #
> #[Solax-BatteryControl.Period.Offpeak]
> #start = "22:05:00"
> #end = "6:55:00"
> #min-charge = 30
> #grid-charge = true
> #grace = false

Formatted text. BT - Moderator

Is it successfully talking to the inverter? This config is expecting to be able to resolve the hostname ‘solax1’ on your network.

You also need to set the source field under Solax-BatteryControl. If you aren’t running an external meter (IIRC you aren’t), then it should be be set to the inverter name.

I will go and give it a go.

In my old config file that did work

[Solax-BatteryControl]
#source = "MainsMeter"     # The data source for power consumption
linked-batteries = true   # If set, all batteries charge/discharge at the same rate when trying to zero total power
#timezone = "AEDT-10" # If set, always use this timezone for period calculations. This may be useful if your machine tracks daylight savings, but your energy provider does not

I can ping solax1 ok
and
Changing source = “solax1” does not cause the battery to start discharging the battery.

There are a number of debug lines commented out in Outputs/SolaxBatteryControl.py

Could you please enable them and re-run the script by hand? You can then post the debug output which will give me a hint as to what is going on.

I think I have turned on the debugging, Log file is attached.

Log.txt (21.9 KB)

I got powerscraper running and putting data into Influx. If anyone is interested in the Influx-Output I can share the code.
But because I have most stuff in Node Red I tried to get it running with the same config as in PowerScraper script. I can connect to Modbus via the node-red node and I get values but they make no sense. So I struggle with decoding to values from ModBus to human readable values. Could somebody help?

Hmm, It’s reporting that it’s not seeing any incoming power.

Can you also attach the new & old configs?

Happy to take PRs.

I think the best approach would be to add another output module to output via MQTT, then you can consume the data easily in Node Red.

Unfortunately, I can’t share the Solax documentation with you :frowning:

I have had a little click about and now getting some data

solax1 In range for single phase
Phase 1 power is 0
solax1 to discharge at -766.5W

these figures look the wrong way round, could it be Inverter Power & Measured Power were swapped

Interesting, you can try git revert 3c7e5e654c474eed8774949a9a9d099818ca4bd2 and see if that resolves the problem.

If it does, could you please show me the graphs of inverter power & measured power from when the inverter was not discharging the battery?

That version did not work, I am now in the time period of discharging the battries.

the version before worked ok and showed the battery current discharging

i @deece

When you mention"Slave" are you rinning multiple inverters in Master/Slave mode

Can you describe more. I have two SK-SU5000E units that I am going to be setting up. One has Solar + Batteries, THe second will only have Batteries

I woud be interested in the actual config and connection between the two

Many Thanks

No, there are 2 separate chips on the inverter board labelled master and slave.

However, the configuration you are suggesting is fine, I wrote this software as I have 3 inverters that need to be synced.

Thank you

So does it manage each inverter seperatly and tells each one to charge based on the meter?

Appreciate the help