Solaredge Modbus Configuration for Single Inverter and Battery

I have my automation setup so when the EMHASS value changes (trigger) it then sets the corresponding values for the inverter.

I have my EMHASS update every minute using MPC.

Happy to help you with an automation.

What is the sensor entity for your inverter to change the battery settings?

So my sensor from emhass i want displayed in that line is
sensor.solaredge_i1_battery_forcast

This is the variable number for forcast but i halved it as i have multiple batteries

This is the sensor name im trying to change
Sensor.solaredge_i1_storage_discharge_limit

The storage discharge should have a number.solaredgeXxx entity not a sensor.solatedgeXXXX entity.

Sorry, yes it does

number.solaredge_i1_storage_discharge_limit

Use something like this automation, triggered off sensor.p_batt_forecast.

Then your storage_dischage_limit will follow the values suggested by EMHASS.

It doesnt change the values.

Could you send me the yaml script for that automation?

I tried to see if i can get it to change once Remote was requested but it doesnt seem to follow this and impliment anything. So i tried a few different methods as you can see but nothing is triggered,

Ive even set the states and still nothing. It doesnt seem to want to impliment the value over to the Solaredge discharge section.

alias: "Solaredge Emhass Discharge "
description: ""
trigger:
  - platform: state
    entity_id:
      - select.solaredge_i1_storage_default_mode
    to: Discharge to Maximize Export
    for:
      hours: 0
      minutes: 0
      seconds: 5
  - platform: state
    entity_id:
      - select.solaredge_i1_storage_command_mode
    to: Discharge to Maximize Export
    for:
      hours: 0
      minutes: 0
      seconds: 5
  - platform: state
    entity_id:
      - switch.sonnen1_emhass_override
    to: "on"
condition: []
action:
  - device_id: e7533ab689f119d5f6982876578ab7eb
    domain: select
    entity_id: df3e28a25183ad78bd53381ee2232533
    type: select_option
    option: Remote Control
  - service: number.set_value
    data:
      value: "{{states('sensor.solaredge_i1_battery_forcast')|int(0)}}"
    target:
      entity_id: number.solaredge_i1_storage_discharge_limit
    enabled: true
  - service: number.set_value
    data: {}
    target:
      entity_id: sensor.solaredge_i1_battery_forcast
mode: single

For anyone also reading throgh this threade. I had to ring solaregde and have them remove Amber (VPP) from the control to resume my control. Now I have full function again

What happens when you manually change the value in that number entity on your dashboard?

Does it change briefly and then return to a fixed value?

Is your SolarEdge inverter enrolled in Amber SmartShift or another VPP/ Grid Services ? If so you may not be able to change those values unless you unenroll. Oh, I see your follow-up so you are unenrolled which is good.

Yes, Ive resumed full controll.

The values i put are working. Ive even setup up a dumb discharge feature through node red and i can input the values using automation, But i cant have that number a variable.

So these flows trigger automations as im working on getting node red smoother using other flows,

But as ive said i can put a variable solution in place for some reason.

Curious if you could try on your system using the site limit as a test as you dont have the same functions as me as your using a tesla. If yours is displaying across could you show me your automation that made that work as ive tried this also.

Try to simplify your automation to get it to work

alias: p_batt_forecast automation - solaredge
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.p_batt_forecast
    to: null
    enabled: true
condition: []
action:
  - service: number.set_value
    data:
      value: "{{states('sensor.p_batt_forecast')}}"
    target:
      entity_id: number.solaredge_i1_storage_discharge_limit
    enabled: true
  - service: number.set_value
    data:
      value: "{{states('sensor.p_batt_forecast')}}"
    target:
      entity_id: number.solaredge_i1_external_production_max
    enabled: true
mode: single

Manually switch Remote Control and Discharge modes. (& External Production)

Then run the automation manually.

Have a look at the automation traces.

Get it working from a very simple automation first before trying to replicate in node red and your Sonnen battery

I don’t have i1_srorage, but this script did change i1_external for me.

This automation has been tracking very closely for the last 24 hours.

This error originated from a custom integration.

Logger: custom_components.solaredge_modbus_multi
Source: helpers/update_coordinator.py:322
Integration: SolarEdge Modbus Multi (documentation, issues)
First occurred: 31 October 2023 at 04:23:36 (3 occurrences)
Last logged: 05:00:26

Error fetching SolarEdge Coordinator data: Modbus/TCP connect to 192.168.0.67:1502 failed.

@WillCodeForCats sorry to tag you directly, but this is becomming a bit of an issue for me now and I know it’s a “known” issue. I’m just wondering if you could suggest anything I might be able to do to either diagnose the problem or at least mitigate its impact.

It used to happen once in 24 hours, but now it happens regularly twice a day, usually around 8pm and 5am, but that time can vary by an hour either way. This morning it happened just before a scheduled battery grid charge slot and this happened:

Logger: homeassistant.components.automation.grid_charge_battery_to_full
Source: components/automation/__init__.py:676
Integration: Automation (documentation, issues)
First occurred: 05:00:08 (1 occurrences)
Last logged: 05:00:08

Error while executing automation automation.grid_charge_battery_to_full: Connection to inverter ID 1 failed.

I’ve been keeping a log of every time it happens now.

I can’t see anything else in the logs around the same time so I wonder if it’s a polling issue with the inverter?

At the end of the day, I can live with it. I just wondered if there was anything I could do my end to help investigate.

Thanks

Hi Mark,

It ended up working. I just had to turn node red off, the node red cant find the api and i forgot it was on, clearly its conflicting each other.

Ive kept that animation you created and it works a charm.

Thank you

1 Like

hello everyone,

can someone tell me if i can use this integration without having a battery?
basically the installation are just my solaredge panels which sending the produced electricity back to the grid.

I don’t have a battery and use this integration every day.

Have you tried loading it to see if it works for you?

i finally managed to make it work :smiley: i just struggled at the beginning with all the sensor…it is not clear yet what i really need and what not

Sorry for my ignorance, but I don’t have the time to read all 500 posts, and are just wondering if anyone got this working with Fronius Sunspec Modbus?

I’m looking to replace the Fronius integration with Sunspec instead to get more exact values in the Energy dashboard.

I made the integration and I don’t have batteries.

There’s really nothing to investigate within the integration as far as connection errors like that go. When you try to send a command it tries to open a Modbus/TCP connection using the pymodbus library and if it can’t connect it will return the “connection failed” message.

You could go lower level and use wireshark to sniff packets to see what’s happening on the wire between Home Assistant and the inverter.

There is a difference between reads and writes that I have some retry logic on reads to try and avoid unavailable state, but writes only get one attempt and immediately return error on failure. I could extend retries to writes and see how that goes, my concern that it could cause UI problems in HA with delayed responses if there is ultimately an error. Or maybe it will be fine, i don’t know since I can only test writes with my simulator which is more well behaved than the real inverters are.

I also recommend running HA 2023.11.0 or higher or Release v2.4.7-pre.1, either of which will load dependencies for the latest version of pymodbus (3.5.4 as of this writing).

That’s a great work, thank you! I have recently installed SE8K-RWB48 with a battery and have a quick question on AC_POWER values.

Does Inverter AC_POWER (40083 40084 1 I_AC_Power int16 Watts AC Power value) ever go into a negative value same as Inverter DC_POWER (40100 40101 1 I_DC_Power int16 Watts DC Power value) does when charging battery from grid and there is 0 PV production?

It doesn’t seem to be the case for me. While charging battery from grid, AC POWER stays at 0, while DC power is negative. I can see some conditions assume it can go negative: https://github.com/ryanm101/hasolarcfg/blob/2b86032adfff5115df272fdf7fc3184d5c5e7821/packages/electricity.yaml#L162

I have the latest software on the inverter. I had previously a regular SE8K without battery so couldn’t observe a negative value due to lack of battery.