No, not yet. I havent’ had a quiet moment!
Did you get it working?
No, not yet. I havent’ had a quiet moment!
Did you get it working?
Hey @tux43, yes I think it is working OK. I went a different track similar to the way @juande implemented it.
I will have 100% certainty tomorrow if exports run negative (again). The Fronius Modbus setup tripped me up for a bit - but I think all is working now…
Thanks heaps
I’ve just re-read @juande implementation and it seems better than mine. Mine was way too complicated getting the calulations right. I am going to give it a go, with what I understand how it works and report back (no sun at the moment)
I have @juande solution working. It is great and better than mine since the inverter does the ‘heavy lifting’. I don’t need to continually send ModBus commands to the inverter since the settings below limit exporting when my feed-in tarrif is negative.
Glad it worked for you Brett!
I found this was the best solution as the inverter makes everything automatic and HA only selects the desired mode: Full throttle or zero injection.
OK, it’s taken me probably far too long, but here is my setup. Ive go two 8.2kW Symos linked to together & a 5kW Sumo Hybrid inverter at our place, as we are with Amber & paying wholesale prices, we wanted our inverter to all ramp down to just match household consumption when ever the FIT price goes negative.
I have setup all inverters to be controlled by ModBus as a priority, on the Sunspec Float type. when the inverters aren’t receiving any commands they revert to the Dynamic Power Reduction settings.
Inside the configuration.yml file I have added:
modbus:
- type: tcp
name: symo_fronius
host: 192.168.1.18
port: 502
retry_on_empty: true
retries: 3
- type: tcp
name: hybrid_fronius
host: 192.168.1.14
port: 502
retry_on_empty: true
retries: 3
I am using a input_boolean as the mechanism (switch), so that it can be controlled manually or with automations:
input_boolean:
solarlimitor:
initial: 0
Now I have 4 automations, 2 as triggers & 2 as instructions for each mode. The triggers:
alias: Amber SolarLimiter Deactivate when FIT returns Positive
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.amber_feed_in_price
above: -0.01
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.opennem_price
above: -0.5
timeout:
hours: 0
minutes: 16
seconds: 0
milliseconds: 0
continue_on_timeout: false
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.solarlimitor
mode: single
alias: Amber SolarLimitor Activate when FIT is Negative
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.amber_feed_in_price
for:
hours: 0
minutes: 1
seconds: 30
below: 0
condition: []
action:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.opennem_price
below: 0
timeout:
hours: 0
minutes: 16
seconds: 0
milliseconds: 0
continue_on_timeout: false
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.solarlimitor
mode: single
I’m using the data from OpenNEM as second reference to prevent false positive triggering. And the notification for the mobile is probably an overkill, but helpful in the early days. I realise these are different address then everyone else has posted, but they work for my inverters. So these are the 2 actions:
alias: Amber SolarLimitor when Turned On
description: ""
trigger:
- platform: state
entity_id: input_boolean.solarlimitor
from: "off"
to: "on"
action:
- service: notify.mobile_app_name_of_phone
data:
message: >-
The FIT price has Dropped to {{
(states('sensor.amber_feed_in_price')|float * 100) }}c. Solar {{
(states('sensor.solar_production')|float / 1000) | round(1) }}kW,
Battery {{ (states('sensor.battery')|float / 1000) | round(1) }}kW,
Consumption {{ (states('sensor.household_consumption')|float / 1000) |
round(1) }}kW & exporting {{
(states('sensor.smappee_grid_realtime')|float / -1000) | round(2) }}kW.
title: Amber Alert - Stopping Export!
- repeat:
until:
- condition: state
entity_id: input_boolean.solarlimitor
state: "off"
sequence:
- service: modbus.write_register
data:
unit: 1
hub: hybrid_fronius
address: 40242
value: >-
{{ ((states('sensor.smappee_consumption_realtime') | float * 0.25
) / 5000 * 10000 ) | round(0) }}
- service: modbus.write_register
data:
unit: 1
hub: hybrid_fronius
address: 40246
value: 1
- service: modbus.write_register
data:
unit: 1
hub: symo_fronius
address: 40242
value: >-
{{ ((states('sensor.smappee_consumption_realtime') | float * 0.44)
/ 8000 * 10000 ) | round(0) }}
- service: modbus.write_register
data:
unit: 1
hub: symo_fronius
address: 40246
value: 1
- service: modbus.write_register
data:
slave: 2
hub: symo_fronius
address: 40242
value: >-
{{ ((states('sensor.smappee_consumption_realtime') | float *
0.315) / 8000 * 10000 ) | round(0) }}
enabled: true
- service: modbus.write_register
data:
slave: 2
hub: symo_fronius
address: 40246
value: 1
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
mode: single
The more often you repeat the loop above, the more accurately is follows the usage. The 2 inverters together, each receive the codes on seperate slave addresses.
alias: Amber SolarLimitor when Turned Off
description: ""
trigger:
- platform: state
entity_id: input_boolean.solarlimitor
from: "on"
to: "off"
action:
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: notify.mobile_app_name_of_phone
data:
message: >-
The FIT price has returned to Positive {{
(states('sensor.amber_feed_in_price')|float * 100) }}c. Solar {{
(states('sensor.solar_production')|float / 1000) | round(1) }}kW,
Battery {{ (states('sensor.battery')|float / 1000) | round(1) }}kW,
Consumption {{ (states('sensor.household_consumption')|float / 1000) |
round(1) }}kW & exporting {{
(states('sensor.smappee_grid_realtime')|float / -1000) | round(2) }}kW.
title: Amber Alert - Restarting Export!
- service: modbus.write_register
data:
address: 40246
unit: 1
value: 0
hub: hybrid_fronius
enabled: true
- service: modbus.write_register
data:
address: 40246
unit: 1
value: 0
hub: symo_fronius
enabled: true
- service: modbus.write_register
data:
address: 40246
unit: 2
value: 0
hub: symo_fronius
mode: single
Hopefully that all makes sense & will be useful to some. It has been a lot of work to figure out, but happy to help if anyone has any questions about it all. I am currently working on the same sort of thing the automate the charging & discharging of my battery when it is the most profitable
That’s looking great!
What settings did you use on the fronius inverter when enabling modbus? I’m having trouble working out what I’m missing. The logs do show a “GatewayNoResponse” message, but apart from that I really don’t get anything at all…
[EDIT: I had modbus on the inverter set to float instead of int+SF. Now I’m not getting any messages in the logs, which leads me to assume that the message is actually getting through to the inverter now]
Is there any feedback on the inverter side I can check to ensure the modbus is actually working?
Hi @tux43
Wondering if you have any other tips/setup knowledge.
I am running a Fronius Primo 5, and for the life of me cannot write to the Fronius Modbus. Other devices on LAN can (Victron Cerbo), but I can’t get HA to do it.
Config.Yaml
modbus:
- type: tcp
name: primo1_fronius
host: 192.168.10.122
port: 502
retry_on_empty: true
retries: 30
sensors:
- name: MB_FRONIUS_1_40072_AC_Current
slave: 1
count: 1
address: 40071
data_type: uint16
unit_of_measurement: "A"
scale: 0.01
precision: 1
scan_interval: 5
device_class: current
state_class: measurement
..........
Automation
alias: Fronius Negative Power - Limit Output
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.negative_fit_state
from: "off"
to: "on"
condition: []
action:
- service: modbus.write_register
data:
unit: 1
hub: primo1_fronius
address: 40236
value: "0"
- service: modbus.write_register
data:
unit: 1
hub: primo1_fronius
address: 40232
value: "9000"
- service: modbus.write_register
data:
unit: 1
hub: primo1_fronius
address: 40236
value: "1"
mode: single
Fronius:
HA Dashboard showing data on Modbus
HA Logs:
2023-02-05 13:29:27.606 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: primo1_fronius: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-02-05 13:44:47.522 ERROR (SyncWorker_11) [homeassistant.components.modbus.modbus] Pymodbus: primo1_fronius: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-02-05 13:53:04.623 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: primo1_fronius: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-02-05 13:59:46.316 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: primo1_fronius: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
Wondering if there is a setting/adding/code I’ve missed that seems obvious to others?
It looks like you are restricting the control from IP address 192.168.10.81? I assume this isn’t your HA instance. Try removing this within the Fronius. Mine looks like this.
This is a neat thread, so bookmarking.
I don’t as yet have a need for any throttling of export or production other than the fixed limit imposed by my local grid distribution company (and which is set in the inverter’s settings), however the day may come when I may need such a capability.
It would be very cool if these modbus inverter control features could be added to the existing HA Fronius integration.
Hi juande,
I have a FRONIUS GEN24 6KW. I have seen your solution for zero injection and it works for me but I have a question.
Do you know in which modbus register the value that you have set for the export of 150W is stored?
I say this because I would like to modify this value dynamically via modbus.
For example if I want to export that export up to 2000W so that the inverter works in a relaxed way at those times when there is no consumption or little consumption at home.
If I don’t want it to export (zero injection) I set it to 0 or 150 as you have done. But as I say that this value can be modified dynamically by modbus.
I have been looking in the Fronius MODBUS Excel file and I cannot find the address that contains said value.
Thank you
Hi aldifesu
In the Fronius documentation there is no info nor data field to do this. There is only a possibility to adjust to a % Power output relative to inverter max power output. Thus, you could do this by estimating what % if for your inverter 2000W and use this value in the modes register
So that was my reason to configure things in such way
Hope that Fronius can solve this in future
Hi,
what about to posibility to enable/disable Dynamic power reduction algorithm.
With all actual settings after disable and repatelly enable.
Any info ? I don’t found such a Modbus telegram or http API statement.
I wrote a case email to Fronius, but still no answer.
HI, I have the same problem with a Primo gen 24, similar interface. At the moment I connected it to HA via WiFi, no Modbus cables.
It’s not clear if it’s the same thing (so I must send ModBus commands via IP) or if there’s an easier way to do that.
My problem is that the mains line has an overvoltage problem, so when the voltage begins to rise I need to cut production power to avoid the inverter being disconnected and having to wait 5 minutes for the restart.
Correct, send the modbus commands via IP, you don’t need cables.
I would be adjusting the Fronius inverter’s volt-var and volt-watt settings first before applying your own production control. Usually each region has recommended settings for this. The volt-watt and volt-var settings are designed to manage grid over-voltage by both production limitation and by injecting more reactive power.
They made a big difference in our case. I was getting regular grid over-voltage shutdowns. Haven’t had one since making the changes.
The other method of over-voltage control is adding load, as that helps to reduce voltage. My water heater is really good for this.
If I understand correctly these settings are behind a “region setup” that is locked and requires a specific password. I will ask my installer.
I can’t add loads at will and even when I can I can’t always control how long they’ll be operating (the washing machine will pause and this usually is enough to cause it to disconnect.
Pretty sure they are user adjustable via the Inverter’s display menus. But you do need to know how to access them.
The regional settings are there to make it easy for installers to ensure the inverter complies with the most recent requirements for the local power grid.
In my case the local standards changed a couple of years after mine was installed. I updated to the latest and it really helped.
I have no display on my inverter, it’s all done via the web UI. The regional standards get updated when I update the firmware because there’re notes for that, but I have no access. Will ask the installer anyways.
Ah, newer Gen 24 model?
OK, yeah check with installer. It should have been installed with the relevant country/region codes.
What I found with mine is the regional codes with latest set up standards were renamed and so the firmware updates were not applying any changes to standards on my inverter. Don’t know where you are. Here (Australia) the latest volt-watt and volt-var standards were introduced on 18 Dec 2021.
Volt-watt does some of the job but it was volt-var for me which made a big difference.
This was what I was dealing with:
The dots are voltage samples for each phase (red, white, blue) a month or so before and after I put in place updated volt-var settings. Note in particular the white dots consistently exceeding 258 V before making the change.
I would experience regular inverter shut downs due to grid over-voltage.
I also captured the inverter’s error codes:
That was over a year ago now and I have not had a shutdown since.