biemond / solaredge.modbus

Homey Solaredge modbus app
GNU General Public License v3.0
8 stars 9 forks source link

charge battery from the grid #57

Open kicksev opened 11 months ago

kicksev commented 11 months ago

Hi, I have a Solaredge 3f 10,5K system with a battery and I am using the SolarEdge + Growatt TCP modbus app in my Homey Pro. I am looking for a way to charge the battery from the grid. When setting Storage Control to "remote control"and Storage charge/discharge mode to "charge from PV+AC", the house is charged from the grid and the battery is only charged from the PV. As the PV power becomes 0, the house is still charged from the grid and the battery is discharging to the house with a tiny 0,05kW. The battery never gets charged from the grid. What modes should I set to make the battery being charged from the grid?

biemond commented 8 months ago

maybe in the new year you have some new quota.

biemond commented 8 months ago

it was always there , never showed this on the device.

CaptainVoni commented 8 months ago

maybe in the new year you have some new quota.

That was also my first thought. But at least we might have an idea right now what’s going on.

biemond commented 8 months ago

will make a device action so you can change it.

CaptainVoni commented 8 months ago

storage_accharge_Limit 0 xxx Storage AC Charge Limit

Why do you set this to zero? In my understanding it is only considered when option 2 or 3 is chosen for the policy.

When do you send the value for the policy to the inverter? At startup? Because I restarted my Homey right before grid charging suddenly worked.

biemond commented 8 months ago

nop , I never touch or set this. just reading. there is no code which can do this on the app.

biemond commented 8 months ago

I got these

storage_control_mode 1 xxx Storage Control Mode
storage_accharge_policy 1 xxx Storage AC Charge Policy
storage_accharge_Limit 0 xxx Storage AC Charge Limit
remote_control_command_mode -1 xxx Remote Control Command Mode
remote_control_charge_limit 5000 xxx Remote Control Charge Limit
remote_control_command_discharge_limit 5000 xxx Remote Control Command Discharge Limit
remote_control_command_timeout 3600 xxx Remote Control Command Timeout
remote_control_default_command_mode 0 xxx Storage Charge/Discharge Default Mode
CaptainVoni commented 8 months ago

Different topic:

remote_control_command_timeout 3600 xxx Remote Control Command Timeout

Doesn’t that mean that the charge/discharge setting is reset after one hour? I thought you set this to 86400 - it was that a different setting?

biemond commented 8 months ago

I think a hour is the default for reset.

I do more

      if (type == 'storagedefaultmode') {
        const storagedefaultmodeRes = await client.writeSingleRegister(0xe004, Number(4));
        console.log('controlmodewrite', storagedefaultmodeRes)

        // set timeout to 6 hours, done in seconds
        const remoteTimeout = await client.writeMultipleRegisters(0xe00b, [ Number(21600), 0 ]);
        console.log('remote_control_command_timeout', remoteTimeout);
kicksev commented 8 months ago

@CaptainVoni @biemond I may be too late with this link to the document you asked for: https://www.photovoltaikforum.com/core/attachment/88445-power-control-open-protocol-for-solaredge-inverters-pdf/ I see Biemond wrote some code to set some registers. Although I have programmed a lot of my life, I'm not familiar with this coding, so could you tell me what is done and if this can help me to charge from AC?

CaptainVoni commented 8 months ago

@kicksev If I’m not mistaken, @biemond will update the app in the next time, so that it will be possible to change the policy setting.

Patience, young padawan! 😉

biemond commented 8 months ago

I think we don't care about Storage AC Charge Limit if we can set this Storage AC Charge Policy

Storage AC Charge Limit is used to set the AC charge limit according to the policy set in the previous register. Either fixed in kWh or percentage is set (e.g. 100KWh or 70%). Relevant only for Storage AC Charge Policy = 2 or 3.

biemond commented 8 months ago

Can you try the menu action, it works for me https://homey.app/a/solaredge.modbus/test/

Screen Shot 2024-01-14 at 17 30 27 Screen Shot 2024-01-14 at 17 30 34
CaptainVoni commented 8 months ago

@biemond IT WORKS! 🎉 Thank you so much for solving this! @kicksev Also a big thank you to you for identifying the problem!

biemond commented 8 months ago

cool , in a few days when I don't hear any issues , I will publish it to release..

how did you like my German? bit rusty on that but google helped me a bit.

biemond commented 8 months ago

By the way is device action enough or do you want a flow action?

CaptainVoni commented 8 months ago

cool , in a few days when I don't hear any issues , I will publish it to release..

In the meantime I added a flow to charge every day at the cheapest hour just for testing purposes. I will let this activated for a week or so to see if any problems arise.

how did you like my German? bit rusty on that but google helped me a bit.

Pretty fine. The labels for the options are all perfect, for the policy I would use "Speicher-AC-Laderegelung" instead. If you need German translations for any project, just let me know - I'm happy to help.

By the way is device action enough or do you want a flow action?

I'm not sure. Do we know if this setting will revert to some default after some time? Or after a restart of the inverter? Or an update? If a flow action would be available, I would set the policy every time I activate grid charging - just to be on the safe side.

@kicksev Just out of curiosity: what policy option was selected for you? At my inverter it was set to "Fixed Energy Limit".

@biemond Did I already say thank you? Thank you!

kicksev commented 8 months ago

@biemond Thx for your support, I'm very happy with this option. I set mode to “Always allowed” and “charging from PV + AC” immediately started at 5kW, then I set “Maximize export” and discharging at 5kW started after a few seconds. Back to “Max Self consumption” was also OK. I agree with CaptainVoni according the need for an action. @CaptainVoni, As I updated the app in homey the Storage AC Charge Policy was already set to Always allowed. the TOU option of Solaredge is useless, If from now on charging from AC keeps working, I will optimize the system through Homey. I made also some flows. I fully charge at cheapest hour at night, set Disabled when full and start Max Self Consumption at most expensive hour. If there is not enough PV power to power the house and car, this will do the job.

CaptainVoni commented 8 months ago

@biemond Just to report back: battery is charging without any problem every day now. I couldn't spot any other problems either, so for me it's fine 👍

kicksev commented 8 months ago

@biemond @CaptainVoni If the status is charge PV+AC (by Homey or TOU in app) then at 5:00, the status is suddenly changed to Max Self Consumption although the battery is not fully loaded yet. Any other time of the day this does not happen. Any idea where this comes from?

image
CaptainVoni commented 8 months ago

@kicksev What happens if you reset the status to PV+AC at 5:01? Does it continue to charge? Do you set the status always at 4:00 and it resets at 5:00? What happens if you set the status at 3:30? Does it reset at 5:00 or 4:30? It might have something to do with the timeout of remote commands.

biemond commented 8 months ago

it can this timeout after you do a custom action, I think my timeout is 6 hours plus never exactly on the hour. But I think Solaredge is doing this forced because they think it is wise and mostly more expensive to charge from grid. maybe some cron on their side

kicksev commented 8 months ago

@biemond, @CaptainVoni Homey sets the mode to charge PV+AC at the time when power price is at lowest and releases the battery power when price is at highest. At this moment it is only saving about 1 euro per day but I suppose that the in day price difference will grow in the future and I will be prepared. Homey sends me an email every time one of the 4 statuses of the PV system changes. I just had a good look at them, and I saw that now and then the inverter goes into maintenance mode and at the same time the charge/discharge mode is set to MSC. This happens almost every day around 5:00 AM, 19:00 PM and sometimes in between. Solaredge does not reset the statuses to the previous value. It is probably a Solaredge bug and I have to find a workaround. In the screenshots you see that Thursday charging was started at 1:01 am and complete at 2:55 am (status set at Off by Homey) and after some I don't know why status changes at 5:00 am maintenance started. On the screenshot of today you can see that charging started at 4:01 am and maintenance at 5:00 am and that charging stopped as mode was set to MSC.

Thursday image

Friday

image
biemond commented 8 months ago

interesting -> inverter goes into maintenance mode let me check on my side if I have also these maintenance modes.

CaptainVoni commented 8 months ago

I added a flow that logs any status changes of the inverter to the timeline. I don’t see any maintenance on my side, so this might be specific for your inverter.

Regarding your cost savings: I know, no one wants to hear this - me included - but did you consider the wear and tear of the battery when calculating your savings? I did that based on the guaranteed amount of energy that can be taken from the battery during its whole life and ended up with about 0.20€/kWh. That’s just the cost for the actual process of charging and discharging the battery with one kWh and without the cost of that one kWh you have to charge the battery with before you get it out again from the battery. I ended up with using just 0.10€/kWh in my battery optimisation flows, otherwise the battery won’t be used at all. My current costs for electricity out of the battery are 0.182€/kWh, but only if charged only from PV (0.10€ for wear and tear and 0.082€ for electricity from PV).

biemond commented 8 months ago

same for me , just producing, offline , no maintenance.

kicksev commented 8 months ago

@CaptainVoni I did not make that calculation, but I fully agree that batteries do not render. How many times the batteries can be charged and discharged and what is the charging/discharging efficiency in your calculation? I bought my batteries primarily for backup as I expect blackouts in the future due to a failing energy transition. Besides that, I am curious to find out how much extra PV power my batteries can save from sending to the grid. What is the main reason for you to buy batteries knowing they will not make you rich?

biemond commented 8 months ago

yep and you loose 10% in all the conversions but for me it is a hobby . also like to have this bi-directional charger plus this backup system of solaredge. maybe after 2025 will do dynamic tariff.

CaptainVoni commented 8 months ago

@kicksev For me it’s the same as for @biemond : mainly a hobby. I want to see what is possible, knowing that overall it will cost me a bit more instead of actually saving money.

I based my calculation on (i) the guaranteed amount of electricity I can get out of the battery according to its data sheet and (ii) the price I paid for the battery. That gave me around 0.20€/kWh. As I hope that I will get a bit more out of it than the guaranteed amount and that battery prices will have fallen when I have to replace it, I use just 0.10€/kWh in my optimisation strategy. This of course means that the battery will only be charged from the grid if the difference between the highest and lowest price is more than 0.10€, which is very rare these days, e.g. today is the difference only 0.03€.

biemond commented 8 months ago

after a week , I never had maintenance , only sleeing , producing or producing throttled

kicksev commented 8 months ago

@biemond , @CaptainVoni My system data and version numbers are

image image

What system do you have?

biemond commented 8 months ago

Model | SE4000H-RWS00BNO4
Communication Board (CPU) Version | 4.17.218 DSP2 Version | 2.0.1305 DSP1 Version | 1.0.1616

SolarEdge Optimizer P370

LG Chem RESU 10kWh

CaptainVoni commented 8 months ago

See below my previous and updated versions. image

@biemond FYI: it seems like that the control mode “Remote control” was replaced by “Remote Control + TOU”. Right now I don’t see any issues.