Hi Henrik @hossians,
I did, it’s working for me but might need some polishing before ready to release. At the moment, I’m managing when and how quickly the battery will be charged. Due to regulations here, my AC output to the grid is limited by 70% of the total kWp installed. Im fetching forecast data for PV production from solcast.com. If the forecast is above a certain threshold I limit battery charging to the peak hours of the day to make sure the system is always 100% productive.
The main part is to control the charging flow, this is done with the following command:
service: modbus.write_register
data:
unit: 1
value: '500' # charging value in Watt
hub: fronius1 # name of your modus hub
address: 40366 # rmodbus register to control charging "InWRte" (-1 offset observed in the register numbering)
If you want to control discharge, you can use address 40365 “OutWRte”
The improvement I would still do is to implement some state information that charging has already been configured if this has triggered once - otherwise, in case of clouds or other impacts to your solar production, the condition is met multiple times in a short period and the register is written more often than necessary.
Thank you Oscar! That is really good to know, then I can proceed with sourcing the Fronius inverter.
I’m planning to buy and sell “per hour” as we can see very big swings in the price over a 24h period. I don’t have the 70% limitation in Sweden so the battery and the inverter will be the limiting factor for selling, but buying we have a monthly power tariff so that is a little bit more tricky. Will have to do some nice calculations to find the optimal sell/buy rates and thresholds…
The list of registers that is writeable, where did you find them?
This is how the updated reading section looks like. The changes are only in the first three sensors (reading_energy_main_meter, reading_energy_inverter_ac_output, reading_energy_battery_soc_scaled)
But now i’ll start from the top as newbie if thats ok.
Modbus should be set as float or int+SF?
Your meter address is 200 - where can i find that address in the web interface ? What i found on my system is SmartMeter Modbus address: 1
The slave 1 - i assume this is the first invertor. In case i have 2 invertors daisy chained and one smartmeter, i should make the same config for slave 2, correct?
Is there any way to retrieve the MPPT DC value ? Currently i get it using json API from history
Thank you again and i hope you do not mind all the questions.
Hi, I have only a few mins so i’ll cherry pick from your questions, hoping others with multiple inverters and smartmeters will be able to help you in the rest (i have only 1 symo without smartmeter)
Modbus should be set as float or int+SF?
Up to you, it was easier for me to find out that the register addresses are misaligned with the documentation (debugging standard integers and translating from hex was faster), and then i got stuck with this config. One caveat, if you read int+SF, those must be read in the same query. If you define multiple modbus entities, those will be separate queries. I thought that would be an edge case when during the readings the scale factor changes, it turned out to be occuring multiple times a day causing spikes in the data, messing up stats. You also will need a template entity to do the math.
I did not change to float, because not all data can be read in float format, there is some registers still in int+sf format regardless of the default setting.
i.e. MPPT data is in a different register if you’re in float mode, but the data is still in int+sf format.
Is there any way to retrieve the MPPT DC value ? Currently i get it using json API from history
Realtime MPPT DC values only available via custom modbus at the moment. Btw i had issues with the json api - values not refreshing in time etc. so this was the reason for modbus at all.
You can get past data from REST API, which is lagging and not realtime, but also had trouble with it, it was not stable.
Official and a 3rdparty integration is working well, but I havent seen any with MPPT values - therefore I made my system read all info from the inverter directly - via Modbus, where this data is available to read.
Possible that there will be an integration in the future handling this, maybe there is one already in development, but native modbus works rock solid. All the past errors with this interface was caused by breaking changes introduced…
Can you post all your config for modbus please? and for the sensors in HA ? For all non tech people like me that have a really hard time doing it by themselves despide all the info provided.
@hossians did you go for a Fronius or Sungrow inverter? I’m about to install sungrow hybrid inverter and battery in Torslanda and I want to control charge/discharge based on spot price as well as peak shaving.
I tried your example and everything works great, except for the reading of multiple raw values. I just don’t receive any data for that. Does that still work for you?
I got this working now using “1_DCst” and “2_DCst” (Operating state string 1+2). If it’s status is not “4” (which is normal operating), i set all depending values to 0. So now my graph is “clean”.