Fronius Modbus Integration

To make it easier to use control a Fronius Gen24 inverter with battery storage and smart meter I’ve created a new custom integration:

Notes:

  • Still working on getting the integration into HACS repository, so if you want to use you need to copy it manually.
  • The integration provides a basic set of data points needed for monitoring and controlling the battery storage.
  • Only tested Gen24 inverter with battery storage system. In theory it should work without battery storage too.

As it is my first integration expect some breaking changes to come…

Any ideas for improvement are welcome!

5 Likes

Do you have any screenshots or examples that showcase what can be achieved with this integration?

I would also be interested in more information about this :slight_smile:

Here are some screenshots of the devices created by the integration, starting with the Battery Storage:

And showing the actions for the battery storage:

Inverter device:

Meter device:

1 Like

Thanks! It looks awesome! Hate to be that person :man_facepalming:, but I did flag an issue on GitHub. Seems like I can’t add the inverter :sweat_smile:. Think you could work your magic on that? :pray:

Hi, I have the same problem as Klangen82. Do you have any idea, what’s the problem?

I’ve started to add some description on the data points and what the actions do:

To make it clearer I will add another table to show which setting is being used by the various actions.

Hi :wave:!
Just out of curiosity:
My Symo Snap-in Inverter also has a Modbus interface. According to the documentation, this is “SunSpec” compatible SunSpec Modbus Specifications - SunSpec Alliance .

  • Would you happen to know if all Fronius inverters / Dataloggers support Modbus - and have compatible registers?
  • Further, are those SunSpec specifications defining exact registers so those are fully compatible with your integration?
  • If so, could a generic “SunSpec Modbus” integration do the same as yours - or are there vendor / Fronius specific details that have to be considered?

If you need someone to test this on non-Gen24 Symo inverters, I’d be happy to help.

Also, as the maintainer of the current Fronius Core Integration, I’d be happy to help if you are interested in bringing this to HA Core.

Btw.

current Core Integration doesn’t use cloud, but local json API :wink:

Hi!

This looks like a great and useful integration! Unfortunately, I’m having trouble using the “Grid Charge Power” function – nothing happens when I change that parameter. The charging is stuck on 500 W.

I have set “Storage Control Actions” to “Charge from Grid” and then tried to limit how many watts it should charge with. However, there is no effect when I adjust the slider.

Could this be related to the “Max Charging Power” sensor? For some reason, it shows -24,576 W for me.

Primo GEN24 6.0
Firmware: 1.30.7-1

I’m working on a new version that is more intuitive to use. Currently the order of changing settings needs to be followed.

Just pushed out a new version with reworked Storage Control Mode behavior. The relevant inputs can be changed when the mode is active. See the documentation which controls are used and which are ignored in the various modes. Hopefully this makes it more intuitive to use the controls.

Unfortunately I didn’t have enough time and enough sun light :slight_smile: to test all scenarios.

@Farmio to answer your questions:

  • So far I know more Fronius inverters support Modbus and they should be mostly compatible.
  • The integration uses SunSpec format for Inverter and Meter data, but for actually controlling the registers it seems Fronius specific. At least the SunSpec integration cannot control it.

It would be great to integrate this into current Fronius Core integration, but it will be good to get storage controls solid first.

What inverter do you exactly have? I can add it to list of supported inverters so you can test if it works.

I have two non-Hybrid SnapIn Inverters on two different grid interconnection points: a Symo 5 and a Symo 20. Both connected to a Fronius SmartMeter. No battery, no Ohmpilot.

Just pushed out a new releases with the following changes:

  • Added control for discharging the battery to the grid
  • Disabled check for Gen24 inverters, so allowing to test the integration with other types of Fronius inverters.
  • Minor bug fixes/tweaks

This is just great, I was getting crazy remembering each evening to start the charging from grid manually… I’ll definitely test this.
May I ask you some screenshot a for comparing the integration and the fronius local interface?

I usually define only the minimum change rate to like 1000 W for 4-5 h during the night so I charge into the battery the 5kWh I’ll Need during a cloudy day. Is the logic the same?

I’ve added mapping to documentation between the Fronius UI and integration. Hope this helps to convert your rules into HA:

Web UI name Integration Control Integration Mode
Max. charging power PV Charge Limit PV Charge Limit
Min. charging power Grid Charging Power Charge from Grid
Max. discharging power Discharge Limit Discharge Limit
Min. discharging power Grid Discharge Power Grid Discharge Power
2 Likes

Many thanks for this integration!

Installed my Gen24 in 2022 and wanted to automate but manually creating all the ModBus sensors was just a bit too much. Occasionally searched if anything new had came up, and this time your integration did!

It was easy to install via HACS, just added https://github.com/redpomodoro/fronius_modbus/ as a custom repo in HACS (instructions does not mention this) and then it could be installed.

If I may suggest a minor improvement; that the integration would either provide a static entity prefix or allow a custom prefix at installation, so the entities it provides can easily be identified in a HA instance. For example, the entity name sensor.temperature is very general in it’s naming, if all the entities would have a prefix like sensor.frmb_temperature they would be much easier to search for, to include in dynamic lists and dynamic configuration entries.

Oh, this is GREAT, thanks! I’m definitively going to use it from right now since I’m always short of energy during winter (neighbours trees :confused: ) and the existing inverter web is not very user friendly to wisely set a charging strategy. I must admit it took me some time to wrap my head around the different tables you put in the docs, but after I did some tries on my system, everything is clear… and I realised how powerful this is!

I’ll be actively using it, so let me know if you want me to test something in particular. I have never coded anything for HA and the following months are going to be a bit hectic here, but I’ll try to go through your code and help if I can.

Some comments (with the sole aim to help :slight_smile: )
“PV Charge Limit”
It is not the first in the list of controls while it is referred to as the first one everywhere in the documentation and -old- screenshots. Not a big deal.

Using % or W/kW
It would be great to have the charge/discharge limits in W or kW rather than a % of the total power. Not sure if this can be done automatically at the time of setting up the device once the maximum capacity has been read, or if it would require the user to provide it beforehand in order to set the limits to the sliders…

“Minimum Reserve”
It is independent of the “SoC Minimum” in the “Battery Management” screen of the inverter site. Is this the expected behaviour? If so, it is good because the original one in the web can be left as a fallback in case something goes wrong in HA.

Possible clash
What would happen if I have a charging schedule set through the inverter web and this integration commands something different? I haven’t tried :sweat_smile:

Edit:
Primo GEN24 3.6
BYD 5.12 kWh

I noticed the settings selected by the user are changed when different Modes are selected… I understand some of these settings are ignored depending on the settings (as per the table provided), but changing the values selected by the user in HA seems a bit confusing. I see it is done through change_settings every time the Mode is changed (set_auto_mode, set_charge_mode, etc).

In my opinion, it would be better to decouple the user choices from the actual values in the inverter, and only internally use the relevant values and ignore/overwrite those not needed in a specific Mode. Otherwise, selecting one Mode and then to another one could lead to unexpected results.

I also noticed a weird behaviour:

  1. I set “Grid Charge Power” to 10%
  2. I change “Mode” to “Charge from Grid”
  3. Unexpectedly, the “Grid Charge Power” changes to 100% and the inverter charges at full throttle.

I believe the logic to check if the setting is below 0 fails:

    def set_grid_charge_mode(self):
        grid_charge_power = self.data.get('grid_charge_power')
        if grid_charge_power is None:
            _LOGGER.error(f'Grid Charge Power not set')
            return
        if grid_charge_power == 0:
            grid_charge_power = 100
        discharge_rate = grid_charge_power * -1
        self.change_settings(mode=2, charge_limit=100, discharge_limit=discharge_rate, grid_charge_power=grid_charge_power)
#        self.set_minimum_reserve(99)
        _LOGGER.info(f"Forced charging at {grid_charge_power}")

Not familiar with the internals of HA, but could it be the value from charge_rate = self.data.get('charge_limit') is not the expected one??

Changing to other Modes also seem to scramble the limits (sorry, no time to look at it now).

Great suggestion! I’ve added to the list for a future release:

1 Like