Fronius Symo Gen 24 plus Batteries

Beware this hurt my head, but I’ve managed to force charge and discharge on command. The key is using negative numbers to set the minimum charge and discharge rates. Like setting the minimum rate in the solar start battery management:

This concept is explained really well here, picturing it really helped https://loxwiki.atlassian.net/wiki/spaces/LOXEN/pages/1316061809/Fronius+Hybrid+with+Modbus+TCP?focusedCommentId=1698594976#b.-Battery-Charging%2FDischarging-Options

Force charging:
You have to set the outWRte rate to negative, but I got errors passing a negative int to modbus. So, I have a template that sets the rate to 100%, multiplies by 100 for scale factor 2, and makes it negative using some form of twos compliment for decimals, I dunno, it works:
{% set outWRte = 100 | int %}
{{ 65536 - outWRte * 100 }}
Then I have an automation to set the outWRte rate and set mode to charge:
action:

  • service: modbus.write_register
    metadata: {}
    data:
    hub: fronius
    slave: 1
    address: 40366
    value: “{{ states(‘sensor.battery_outwrte’) }}”
  • service: modbus.write_register
    metadata: {}
    data:
    hub: fronius
    address: 40358
    slave: 1
    value: 2
    mode: single

Force discharge:
You have to set the inWRte rate to negative and set the mode to discharge. I have a template to set the charge rate based on the available max and min charge level, then divides by 3 hours available to discharge:
{% set SoC = states(‘sensor.battery_soc’) | int %}
{% set MinSoC = 25 | int %}
{% if (SoC > MinSoC) %}
{{ 65536 - ((SoC - MinSoC) / 3) * 100 }}
{% else %}
{{ 0 }}
{% endif %}

And an automation to set the inWRte rate and the mode to discharge:
action:

  • service: modbus.write_register
    metadata: {}
    data:
    hub: fronius
    slave: 1
    address: 40366
    value: “{{ states(‘sensor.battery_inwrte’) }}”
  • service: modbus.write_register
    metadata: {}
    data:
    hub: fronius
    address: 40358
    slave: 1
    value: 1
    mode: single

You can stop the forced charge/discharge at any time by setting the mode back to normal with 0:
action:

  • service: modbus.write_register
    metadata: {}
    data:
    hub: fronius
    address: 40358
    slave: 1
    value: 0
    mode: single

Note you’ll need to change all the address values if you’re using the Int&SF register map.

Also note the forced rates achievable are restricted by the limits of the inverter and battery and the load demand.

Hi huffy - I am very much a HA newbie and have got a Fronius inverter and BYD batteries. I have the Modbus link set up and working and am now looking to control things a bit more smartly.
I have a couple of queries on your solution - what is the metadata line for in your modbus service call? And I’m assuming that the template sensor you refer to that calculates the outWRTe is the sensor.battery_outwrte? I’m going to have a go at setting this up, just need a bit more explanation!

Thanks for your help,
Steve.

Hi @SteveM1 , happy to help. There’s nothing in the metadata, not even sure why it’s there, probably copied from somewhere else. Yes, that’s the template entity I’d, which you can find in the list of helpers.

1 Like

Thanks @huffy72 - the metadata line doesn’t seem to make any difference - I now have a number of scripts writing to modbus which don’t use it. Thanks for the reply!

Hi all,

i am getting the GEN24 Plus with BYD Batteries too. Looks like i can use this with modbus to control discharge rate.

Any tips or suggestions for my install before it happens (related to ha integration) ?

thank you very much

Hello Klangen82,

Thank you VERY much for your examples! I copied them and after some tweaking they work on my installation as designed (Full Charge / Full Discharge / Stop Activities).

What I still do not understand, after many hours of trial and error and checking many different forums, is why those numbers (60933 and 4603)?. All I found out is that they add up to the the value of 65536 which is Hex FFFF+1.

The reason I am asking is twofold:

  • I want to optimize my consumption from the grid and
  • I have 2 different inverters connected to a separate EVU. Hence I need to control the charge/discharge seamlessly and based on values from my EVU.

Now I am trying to setup a node-red automation, feeding the GEN24 10 Plus with the required values to keep the grid consumption at +/- 0.

The Fronius register map talks about +/- 1000 for the OutWRte and InWRte, but your values are much different. Am I right assuming (float setting assumed) that one number always need to be 65535 - the other value? Ideally I would want to keep the StorCtl_Mod always at 3?

Do you know where I can find more details on the topic?

Many thanks
Heinz

Hi @ruffieuxh, I need to be honest and say I don’t remember…I have had this running for so long and I don’t touch it anymore. I think there is some thinking how to calculate these values in the thread above.

I think you can find the answer in the documentation also.

Sorry not to be able to help, I blame my bad memory…

Negative values are used to set a minimum charge/discharge rate, and negatives are set using 65536 - A, where A is the percentage of your battery size (WChaMax) you want to charge/discharge in an hour.
It’s because the 65536 number range is in two halves, the bottom end for positive numbers and the higher end represents negative numbers.

Note, you need to multiply your percentage by 100 because of the scale factor in InOutWRte_SF.

To set minimum charging rate at 100%, OutWRte = 65536-(100x100) = 55536.
To set minimum discharging rate at 100%, IntWRte = 65536-(100x100) = 55536.

Also note, you may not get 100% of battery charged or discharged in the hour if the inverter or battery cannot charge/discharge at that rate.

If the above seems the wrong way around, see full details in my post above 20 March.

1 Like

Hi. In new to HA and im trying do make an automation.

I cant code so im trying via HA automations. I have made a button and when that Button is pressed i want do charge or discharge my battery.

My plan is to put that button in to Homey but the automation in HA. So when the button is pressed in Homey i want to run the automation in HA.

But im stuck, i dont know what to put in the THEN.

I have managed to select performe action with inverter (three phase) but i dont know witch action to choose.

Sorry for my bad english.

Thanks from Sweden.

You can create scripts and trigger them in THEN. Go to Settings → Automations & scenes → Scripts → Add Script

I’ve added the following three scripts (note that I use the int + SF setting on the inverter):

alias: Disable Discharging
sequence:
  - service: modbus.write_register
    data:
      slave: 1
      address: 40348
      value: 2
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40355
      value: 0
      hub: fronius
mode: single
icon: mdi:battery-off
alias: Force Charging
sequence:
  - service: modbus.write_register
    data:
      slave: 1
      address: 40348
      value: 2
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40355
      value: 55536
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40350
      value: 9900
      hub: fronius
mode: single
icon: mdi:battery-charging
alias: Reset Charging
sequence:
  - service: modbus.write_register
    data:
      slave: 1
      address: 40348
      value: 0
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40355
      value: 10000
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40350
      value: 500
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40356
      value: 10000
      hub: fronius
mode: single
icon: mdi:home-battery
2 Likes

see Fronius Symo Gen 24 plus Batteries - #46 by Lorbus

Thanks.
Do you have the register for force discharge or set a minimum discharge rate?

For example i want to discharge x watt when the price is high.

Im using Homey to set the flows but i cant find the right register in fronius documentation

I don’t think it is doable with modbus. There are no entrys in the register table for minimum.
Yet you can do it manually with the web interface…

You can set a minimum forced charge/discharge rate by using negative value in the charge/discharge rate.

See here for details Fronius Symo Gen 24 plus Batteries - #37 by huffy72

Thanks, this input has helped me a lot!
The single scripts work flawlessly.
Just one thing I don’t understand:

In case I run the following sequence, I observe the following:

  1. run “Disable Discharging”, the discharging is prevented.
  2. run “Force Charging” afterwards, the charging starts at high power.
  3. re-run “Disable Discharging”, the power gets significantly reduced.

Why?
Doesn’t the script “Disable Discharging” just set the max output power to zero?
The designated charge state of 99% is unaffected, right?
I assume, it will be related to the set value 55536 in address 40355. From the Fronius Excel, I don’t see how to interpret the number. This number exceeds the value range stated in the Fronius document.

How to include this?
How to interpret the value of that address?

I intend to use those

  • not to discharge my battery when charging the car
  • to re-charge the battery in dark times when needed

I would like to have these scripts not affecting each other.
Thanks in advance!

This is great work. Are you going to publish this somehow? I am exactly thinking of building the same.

  • checking the expensives hours => keep battery to have sufficient battery during exepnsive hours.
  • checking cheapest hours => save on battery
  • checking expected PV-production => start charging the battery after 11:00 am to flatten the curve

… Is there a project dealing with theses questions from HA?

Many thanks. Best regards,
Clemens

I think this is what you can look into GitHub - davidusb-geek/emhass: emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant..
I have not tried it myself because we dont have a hourly tariff, but it looks promising.

Hi,
Thank you all for contribution to this valuable thread. From my side just a short summary of values that triggeres charge and discharge limits.

obraz

1 Like

@Lorbus
Hello,
I’m new in HA, and don’t know why don’t the script run :

alias: TEST BYD
description: ""
triggers:
  - trigger: state
    entity_id:
      - switch.chargin_byd
    from: null
    to: "on"
conditions: []
actions:
 alias: Disable Discharging
sequence:
  - service: modbus.write_register
    data:
      slave: 1
      address: 40348
      value: 2
      hub: fronius
  - service: modbus.write_register
    data:
      slave: 1
      address: 40355
      value: 0
      hub: fronius
mode: single
icon: mdi:battery-off
    mode: single
    icon: mdi:battery-off
mode: single```

The message is : ‘’’ Message malformed: extra keys not allowed @ data[‘actions’][0][‘mode’]
Any idea?

actions is from automations
sequence is from scripts
You cant use both in one.
Also you have multiple modes and icons so try to redo the script or automation but use the UI