-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature to put the inverter in backup mode for a number of hours to protect battery SoC whilst EV charging. #284
Comments
Hi, not sure whether you saw it already but over the last six months the basics of an EV integration has been added on to Pv_opt, see issue #121 for full details. For users on IOG, it picks up the charge slots for the car and holds the inverter if not already charging, and also subtracts the car charging consumption from the total consumption to leave the house consumption only. A few of us have been using this for a good few months now without issue. Note for this the inverter is put into charge mode at zero current - backup mode isnt ideal as depending on Solis inverter model this can oscillate between full rate charging and/or self use discharge. For Agile users, code is in place to generate a car schedule based on a "car ready by" time and a "charge to add", and will select the cheapest slots between car plugin and car ready by time to meet the charge target. This sets an entity that can then be used to start and stop the car charger automatically. (This is very much as Predbat does it) I've done some limited testing with this by forcing an Agile tariff and getting it to control my car charger - all appears fine but it does need some more testing. Can your ProjectEV charger be controlled by HA at all? If so, then all of the above has been written for Zappi chargers but if you are ok with keeping "Use Consumption History" as Off for the time being (I imagine it is already) then I "think" it will work for any charger as the Agile car charging part doesn't communicate directly with the charger - maybe a few tweaks needed. The ability for Pv_opt to read an external car charging schedule is for the future. Its queued up behind the ability to set manual tariff times (for Eon NextDrive and Tomato Energy users) and the ability to integrate with two Zappis. |
Neither of these should happen (and don't on my system, where I've regularly set read only for overnight if I'm working on new code which allows me to disable Pv_opt and just do the inverter setting manually). Separately to the EV query/request, if you can post Pv_opt.log and error.log from an overnight run where it does I'll take a look. In the interim it may be worth setting Read only = True in your config.yaml, so if Pv_opt resets for any reason that will be its default state:
|
Will do, thank you very much |
Thanks very much for this information, much appreciated. Unfortunately my Project EV is not controllable via HA. I did try to find an integration but there is nothing official to access it. Someone has tried to put something together by hacking into it with varying degrees of success, but there is nothing official that will work. So at the moment I'm stuck with using the app to charge my car (which works surprisingly well to be honest). Other use cases for this functionality are:
When @fboundy was kindly adding functionality for my Solax X1AC inverter, he setup an additional dashboard for me to send commands directly to the inverter to see if charging commands etc worked: In my mind, something similar to set the inverter not to use the battery to supply load at these times would be the ideal thing. Hope all that makes sense, and if you need any further information I'm happy to provide it. Thanks |
Without a way to control the charger then agreed, the EV functionality I've added won't help you. Thanks for explaining your use case - that makes good sense and I can see how it would be a useful addition in its own right. I'll have a think and see what I can quickly add. Gut reaction at the moment is to provide a switch called "prevent battery discharge". When set, PV_opt would still charge the battery at the slots it needs to but would prevent discharge when not charging. You could then just toggle it manually, and/or use an external automation with start and end times for automated use. |
Are you using this unmodified from what was originally provided? If not, can you:
I'll then put the additional switch into this dashboard so you can test it out. |
That's fantastic, thanks very much for this. This would be really helpful.
Thanks once again. |
Ok theres a Beta release (3.18.0 Beta-15) to try on my fork at https://github.com/stevebuk1/pv_opt/tree/main/apps/pv_opt. Best probably not use HACS to install this, just overwrite the files you need, which is: Essentially I've added a new entity switch.pvopt_prevent_discharge which does exactly that for as long as it is set. I've created a test dashboard update, which is here, When set, it will set the battery charge current to zero and maintain that until cleared. You'll be able to see that in the charge plan via a charge power of 1W and a "<=Car" string, as the new entity is effectively being coupled into the car charging logic that prevents house battery discharge during car charging. Its shown as a slot at a time but will roll forward as slots come and go. I've tested it with my system and all seems fine, but theres been a lot of updates into Beta-15 for other reasons and control of Solax inverters probably hasn't been tested. Post with logs here for any issues. |
Forgot to add that setting this switch will not affect any house battery charge plan. So you can go to bed at 10pm with it set and the house battery will charge overnight to the charge plan as normal. |
That's fantastic, thank you very much for this.
I'm away from home at the moment so won't be able to install and test this
until Friday, but will install and test as soon as I can.
Thanks once again, really appreciate it.
…On Wed, 13 Nov 2024, 21:56 stevebuk1, ***@***.***> wrote:
Forgot to add that setting this switch this will not affect any house
battery charge plan. So you can go to bed at 10pm with it set and the
battery will charge to the charge plan as normal.
—
Reply to this email directly, view it on GitHub
<#284 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNR355W6PHW7PY24WW42G32APDKDAVCNFSM6AAAAABRMJ6GR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZUHEYDGMBUHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
OK, copied the files over and rebooted.
Logs: I can't test the dashboard yet as my battery SoC is 10% so it won't discharge any lower (so I won't be able to test if it's working). I'll test tomorrow when my battery has some charge in it. Thanks |
Hmmm. Thanks for the appdaemon log, I'll get that fixed but I don't think its preventing operation.
to read this:
ie change debug from false to true and add " debug_categories: O" (the letter O, not the number 0) just underneath.
|
Set the discharging to this: Here are my three logs: Also, copies of the oldest logs I have on HA: Hope this helps. Many thanks |
Good news. I expected the tag "<=Car" to appear, but I've noticed its gated on being on IOG and/or having a car charger. As part of this flag set EndSOC is set to the same as StartSOC to keep things neat. You therefore may notice end SOC is not the same as start SOC because the discharge prevention is an override after the SOC calculations are done. Let us know when you've checked out that charging is unaffected. |
Please tell me if I'm misunderstanding. If the above is correct then I have a couple of follow on questions:
Thanks very much |
Yes thats correct.
Yes thats correct also. It will only set a current of zero if Pv_opt isnt requesting a charge.
Also correct.
You can use an HA automation with a couple of datetime helpers to set Prevent_Discharge at 2am and clear it at 4am. If Pv_opt wants to force charge the battery in this time then it can and will.
|
Thanks for this. |
Ah ok. It should do, I'll try that on my system this evening (I don't think I tested it out across a slot transition so there may be a problem there). |
OK great thank you. Ref the earlier reply:
Yes, when this is set to zero, my inverter will not charge (as that's the setting which controls how much power is being used to charge the battery) Can this be set to a default of whatever the maximum power of the inverter (in my case it will set to 20A)? |
Yes that should be an easy fix. I can't imagine Pv_opt doesnt already have code for doing that after a charging slot ends, but perhaps the override logic we've added is operating slightly differently. |
Awesome, thank you |
Given the screenshots show figures above 60 the change hasnt worked or Pv_opt is still processing events that occured prior to the change. It should go: I'll relook at the code to see if its picking up 300 (360) from anywhere else, but I deduced this from the log on issue #299. Please post main.log and pv_opt.log with every post - theres nothing I can really do or investigate without them. All the information from screenshots is in the logs anyway. |
I think both of these are just the delay from Prevent discharge being toggled to the optimiser getting round to it due to the queuing problem in #299. The triggers are done in strict order - the optimiser is being triggered every 10 mins but anything with inverter writes takes 13, the optimiser run scheduled to process the prevent_discharge toggle then go in at the end of that queue.
10% is what Pv_opt predicts the battery will be at 13:30. That prediction does not take account that there is a hold slot in place. (The value at the end of the hold slot is artificially changed to just be the same at the start). What will happen though is that on each run Pv_opt will work out that you havent used as much energy as you were predicting to use during 12:00 to 13:00, and update the forecast, so as the end of the 12-13 slot approaches you'll see that 10% edging back towards 20%. |
Changed the value to 120 so there is now a pause between it optimising, which seems to have calmed it down.
Do we need a rethink on how this works? or do you think we are still on the right track? Thanks |
From the log you posted today everything actually appears to be working, its just long delays between each optimiser run and lags of whats done where that makes it look like it isn't. We just need to solve the 300/360 seconds delay, which is an issue from the original Solax integration development that hadn't affected things too much up to now but certainly does now. For reference my delay is 15 seconds, so a full optimiser run from idle through to idle takes a minute or so. We need to achieve the same, otheriwse, any method of preventing discharge is going to result in more inverter writes and certainly needing 10 minutes for each one will going to cause issues for anything more than the most basic charge window.
No need - the files you have already include the changes made to 3.18.2. I merge production changes into the development code as soon as they are released.
I really do need a Pv_opt.log from you with every post that describes a behaviour. I really can't do anything without them...... |
OK thanks for this. I realised I was having some problems with my inverter / battery charging rate. I ended up speaking with the installer who has helped in hopefully resolving this. Now it's (hopefully) been resolved I will reinstall the beta and start charging / testing again (with the refresh time down to 60 seconds) and we'll see how it goes. Please bear with me whilst I do this. |
For now its probably best that you revert to the production release of Pv_opt and make sure you have stable operation with an inverter delay of 60seconds and see if that resolves the issue you raised . If you think its working a pv_opt.log and main.log would be very useful to see if this solves the issues within #299. I'll also put a similar response in #299. We'll leave this open and come back to it once #299 is resolved. |
Fantastic, thank you very much. Many thanks |
The recommendation for 60secs was entirely arbitrary. If 120s is reliable
we can stick with that. That means everything completes in 5 minutes which
is less than the optimiser scheduled time of 10 minutes.
Can I just confirm that the value of 60 (or 120) is regarding the value of
id_cycle_seconds in config yaml? You referred to it as optimiser time and I
can't see this needing to be set any lower than 10 minutes.
…On Tue, 19 Nov 2024, 22:59 punkymuzzle, ***@***.***> wrote:
Fantastic, thank you very much.
To confirm, now I have reverted back to 3.18.2 and set the optimiser time
to 120 seconds (as 60 seconds was causing issues with the dashboard showing
various states of optimisation).
I will drop this to 60 seconds as requested and leave overnight to see if
this is still OK. If it is I will then re-download the bera files and start
to test the "prevent discharge" option again.
Many thanks
—
Reply to this email directly, view it on GitHub
<#284 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASVRJMFVX5HJASPUV46YQHL2BO7EFAVCNFSM6AAAAABRMJ6GR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBWHEZDAOBRGQ>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
This is the setting I am referring to (in the config.yaml)
This is set towards the end of the .yaml file under the section:
Set it to 60 seconds and no adverse behaviour yet. Is this the wrong setting? I don't have the |
Yep that's the one!
…On Tue, 19 Nov 2024, 23:17 punkymuzzle, ***@***.***> wrote:
This is the setting I am referring to (in the config.yaml)
update_cycle_seconds: 60
This is set towards the end of the .yaml file under the section:
===============================================================================================================
Brand / Integration Specific Config: SOLAX_X1:
===============================================================================================================
These are the default entities used with the Solax X1integration. You can
change them here and over-ride the defaults
Set it to 60 seconds and no adverse behaviour yet.
Is this the wrong setting?
—
Reply to this email directly, view it on GitHub
<#284 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASVRJMHBBXJDO3LELUD4P532BPBJBAVCNFSM6AAAAABRMJ6GR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBWHE2DQMJSHA>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
OK so I just went for it last night and tried it out end to end:
I watched the 1W charging slot be inserted into the schedule just before the car charger started - Worked OK In the morning I came down to a car that was fully charged as well as a battery that was charged as per the PV-Opt schedule, which is fantastic. Attached logs if you need them: my only two comments are:
Once again, huge thanks for working on this. Hopefully this can be added into the production version of PV-Opt, but please let me know if you need anything from me. Thanks |
Pleased it all now seems to be working. Regarding your observations:
Yes that's it. However, when you toggle Prevent_discharge, the optimiser will be triggered to run immediately, so its about 4 minutes for the toggle to take effect. This is a minimum though, this will be longer if done midway through a scheduled optimise, as it has to wait for that one to finish first. Not so convienient for your use case of preventing discharge if someone wants a shower. The delays are unfortunately unavoidable as Pv_opt is reading the status of Prevent_discharge live. The ideal (long term) is that the particular 1/2 hour slots are all setup in advance, then there would be no delays because Pv_opt does the inverter loading 10 minutes before the slot starts. This functionality is mostly incorporated already as PV_opt can read the Intelligent Octopus Go car charging schedule and load all the prevent slots for the night, but thats a very bespoke format that the Octopus Energy Integration generates and it would be quite hard to generate that from a dashboard that has a number of start and end time pairs. I think the way forward on this is to simply have 48 slots in a some sort of drop down list (24 hours of 1/2 hour slots) and one simply sets each slot individually for whether discharge is presented? Or do you think say 3 pairs of start/end times would be sufficient?
Yes please, I'll add them into the repo and documentation.
Theres a few things to iron out in the dev version (unrelated to this) but yes, the intention is to incorporate all of this into the production version. |
Hi However I have noticed a couple of anomalies which I'm not sure if we can fix. These are observations at the moment so I'll keep an eye on it and try and capture the logs when I see this happening.
Apart from the two above issues it seems to be working great. I still have slight issues with the scheduling slots from my automations / helpers (as I need to think of a way to disable the automation once it's been applied at a certain time, to stop it repeating the next day) but that's a minor thing I need to fix. Thanks |
Thanks for pointing this out. Because the Car slots are seen as charge slots (at 1W), then the code Francis wrote to load the next charge slot once the battery SOC approached a "Sleep_SOC" will load a charge of 1W, which isnt much use in lifting the inverter out of its sleep state when the time comes. I'm not entirely sure I can fix this without designating the car slots as something other than a charge slot, which is a major piece of work.
I'd added code to write a current of 20A once any form of timed charge period exited, which should equally encompass true charge slots as well as car slots. This is probably an easy fix but I'll need a log to see where its going wrong. |
Not sure if this will work, but, I have two charging slots available on my inverter. PV-Opt always sets these two sets of sots to be identical, but could we use both slots (one with the 1W slot and the other with the next "real" slot)? Not sure if this would work, but maybe worth thinking about?
Sure, log attached: You might see other errors in these files because PV-Opt has crashed on me in the last few hours and despite me restarting everything multiple times it's hanging on "Optimising Charging Plan" - but that will be for another issue that I will raise. Thanks |
Yes this makes good sense for your inverter but given the core of Pv_opt is written around one start/end time pair and supports multiple different inverter types then I think it might be complex. I'll puzzle some more but this will be long term.
Due to last nights problems the log contains only two optimiser runs that completed, and neither of these had prevent_discharge set. I'd need a log where the 1W slot has just finished and Pv_opt writes the next slot for self use mode but doesn't set it to 20A. |
Of course, not a problem. Last thing I want to do is create lots of extra work for this.
No worries, the next time I use the "prevent discharge" option I'll upload the logs. I won't do it just yet as the p/kW is high and my car doesn't need charging yet (and that would give the best chance of it spanning multiple charging slots) |
Hi Logs attached for information: Thanks |
I'm 99% sure the logs show you are running the production version of Pv_opt, which doesn't contain the prevent_discharge functionality. The usual cause of this is that a new production release was made available on HACS and you have HA set to perform updates automatically, but I don't think thats the case here as the last logs you attached were using the development code and I don't think theres been a new release in the last two weeks. You'll need to overwrite your files with the following development code: https://github.com/fboundy/pv_opt/blob/dev/apps/pv_opt/pv_opt.py Version is now at 3.19.0-Beta-19. I've added a mod in this one to print out the version number on each optimiser run, so in future I'll know for certain what version of code is running. Also, I think we need to increase your log file size and also increase the number of retained logs from 3 to 9, as the last log only recorded about an hours worth of running. Instructions for this are here, Section 11 Step 3: (basically add the lines Along with the debug_categories controls in the development version, this should ensure we always have a weeks worth of log files for diagnostics. |
Thanks for this. I'll look to increase the logfile size as requested. Once I've done this I'll retest (will probably be late tomorrow / Weds) and let you know how it goes. Thanks again. |
Update One thing I have been thinking of is the issue we have around the inverter going into hibernate with 0.0A set (meaning it won't ever charge until I intervene) Would that work? I chose 75W as a nominal figure but I guess we can play with that amount if needed. |
If you are happy with a 75W charge rate for whenever prevent_discharge is set then this is a good idea and I think will work well, as it makes sense to do this alongside a SleepSOC and it can be kept specific to Solax inverters. The dashboard will still display 1W as the plugins for each of the inverters is largely 1 way. The inverter plugin writes a current to the inverter based on required power and battery voltage but we can keep it simple and write a fixed current, probably 1A (I think Solax is a 100V system so thats about 100W). |
Yep 100W is probably a good setting.
Assuming that charging at 100W for 30 mins (as this is the minimum charging
slot) would be sufficient to raise the SoC enough to bring the Inverter out
of hibernation?
…On Tue, 3 Dec 2024, 08:41 stevebuk1, ***@***.***> wrote:
What about if we change the charging rate from 1W to, say 75W? Then if the
inverter hibernates with this charging slot, at least after 30 minutes of
charging at 75W it would have hopefully come out of hibernate (as the SoC
would now be above 10%), thereby allowing pv-opt to write the next charge
slot.
Would that work? I chose 75W as a nominal figure but I guess we can play
with that amount if needed.
If you are happy with a 75W charge rate for whenever prevent_discharge is
set then this is a good idea and I think will work well, as it makes sense
to do this alongside a SleepSOC and it can be kept specific to Solax
inverters. The dashboard will still display 1W as the plugins for each of
the inverters is largely 1 way. The inverter plugin writes a current to the
inverter based on required power and battery voltage but we can keep it
simple and write a fixed current, probably 1A (I think Solax is a 100V
system so thats about 100W).
—
Reply to this email directly, view it on GitHub
<#284 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNR35Y2Y6SB2XMXMKIHFRT2DVVFNAVCNFSM6AAAAABRMJ6GR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJTHA3TQNJSHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
OK, tried it in anger last night but ended up with an empty battery when I woke up this morning. I set my car to charge my car between 01:30 and 04:30. In this time there were several scheduled battery charging slots so I tried to use the "prevent discharge" setting. Woke up at 06:30 to a charged car but a battery which was at 8% SoC (despite a minimum SoC of 10%). So I've had to put pv-opt in read only mode and manually set the battery to charge during the day so it's fully charged by 16:00, when my peak charges apply (the offpeak times are really expensive today so they are double the cheaper overnight slots, so today's bill is going to sting).
Also, logs attached fyi - hope this helps. Many thanks |
Hi, thanks for the logs, the new file size is working well. The one you've attached stretches back to 05:15 but need to get back to 04:30 and also 0:30. You should have nine files in the same area that pv_opt.log is stored in, these are named as follows: pv_opt.log.1 You may not have all 9 files as its not been running that long, but can you attach all the ones you do have. *** edit I meant to say please grab them quick otherwise last nights run will be overwritten with new logs *** |
I've inspected the logs. Theres a few issues here:
|
Brilliant, thanks for this.
Out of interest there is an update for pv-opt (that I've ignored at this time). Assuming I just stick with beta 19 a per the earlier post? happy to install whichever version helps. Please let me know if you need anything further. However I'll be away for a couple of days so won't be able to test any changes for a while, so no rush. |
Attached is an updated one. All changed lines include "SVB".
First aim is to see if the above prevents constant restarts. After copying in config.yaml you'll have to set the readonly switch in HA to false.
Yes this is the plan. If the inverter is holding, just prevent it from sleeping.
Yep stick with what you have. The production release doesn't yet have all this functionality in it. (I don't have write access to the production releases so am dependent on Francis for that part)
No rush! |
Is your feature request related to a problem? Please describe.
I want to be able to set the inverter to set to Backup mode for a number of hours (either a single or multiple slots) when I put my EV on charge, so the battery does bot drain to charge the car.
When charging my Electric car overnight, some of this load will be provided by my batteries. I don't want this to happen as then I need to charge the batteries again before any price increase in the half hourly tariff rates.
So a way to let the inverter know what times the car is charging (so it can not provide battery power to charge the car) would be ideal.
Describe the solution you'd like
I know that other automations (cough - Predbat - cough) have the ability to integrate car charging into the schedule, but that is dependent on a car charger that can be controlled. This is more of a process to protect the battery from discharging whilst EV charging is occurring when controlled via a separate app - i.e my ProjectEV app for my charger.
Describe alternatives you've considered
If the hourly rates slots overnight are relatively cheap then I place PV-Opt in read only and manually set the inverter to Backup mode to prevent the battery from discharging to charge the EV. Then reset everything in the morning.
However the process is not particularly easy:
Additional context
More than willing to test this via beta versions if needed.
My Inverter is a Solax X1AC.
Thanks very much in advance
The text was updated successfully, but these errors were encountered: