Feature Request: First half of day and Second half of day #283
Replies: 14 comments 2 replies
-
I don't think we should, @Noodleyman. It's not a terrible idea, so don't get me wrong. The integration could easily calculate this, as attributes, but needs would vary. The data is there for the taking for those into a bit of Jinja2. Here's something I use that kind-of does a similar thing to what you are looking for, and this actually features in a brand shiny new I participate in a virtual power plant. This is not fully automatic (probably because the power retailer looks like they run on the smell of an oily rag, and don't want to charge high prices, hence don't develop something which suits me fine.) What I do between 11:00-14:00 is to charge 28kWh of battery from the grid for free (and from available PV from 14.5kW max). Then in the early evening when everyone is cooking dinner the feed-in tariff is generous, rewarding a good 'power dump' back for others to use, and so I do so keeping my electric bill in credit (I've not paid for power since September when I switched to this retailer). I don't want to pay for any power in the morning should I go too hard with the dump. So enter my early hours forecast of kWh from sunrise and for the next two hours... This template works out how much I need to leave in the tank to not run out by morning. It does this by utilising an average power consumption between sunset and sunrise, which is quite predictable for my situation. Recently (with shittier weather here) this template has been getting it right to 6% (+/- 3%) remaining at the time in the morning when PV generation can sustain my (not inconsiderable) house base load of ~700W 24x7. I expect to tweak it further in terms of the variables as I get a greater body of experience. (Example: During Winter the house heating fans kick on and off like they do not in Summer/shoulder consuming more power for gas heating overnight, and so the overnight average is probably going to need to be altered seasonally.) If you want a morning and arvo forecast then grab the core concept of this template and have at it. If you get stuck, holler for help. (edit: Revised code slightly.)
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
When you're done with your templates @Noodleyman, I'd love to include them in A stretch goal for yourself is factoring the gap between 'confidence' levels of 10%/50%/90%. I've not yet approached that, but have it on the to-do list with my after sunrise generation calculation template to gauge how likely it is that I'll hit the zero target and adjust aggresively or conservatively. Solcast can be wildly out even at 10% confidence, but they do get it fairly right most of the time. |
Beta Was this translation helpful? Give feedback.
-
Cheers. I'm away for a few days as of tonight, so I'll review the feedback in more detail once back :) Thank you for the examples, I'll have to experiment with it and see what I can come up with. I can document my whole bespoke solution if you wanted to capture it? |
Beta Was this translation helpful? Give feedback.
-
Having spent about 8 years fiddling with charge algorithms, I've found that the easiest approach is the simplest: looking back and finding out at what time of day solar output exceeds house load. Obviously, this changes over the solar year, but it can be condensed down to seasons or months if you want. I just split it into daylight savings and non-daylight savings time, as it is good enough for me. The next thing I determine is the battery level that I typically have at that time of morning after overnight discharge has met house loads. I add 10% to that as my buffer to allow for a particularly cloudy morning. That gives me my target morning state of charge. One figure, at one time (two, if you take into account daylight saving). Working backwards, I then have a target evening state of charge. That is how much charge I need the battery to have to see me through until the next morning. I can then use that target as my target for automations, and it makes for very simple automations: if remaining solar will exceed that, then I can do things like choose to discharge. If remaining consumption will mean that I have excess charge when the sun goes down, then I can discharge into high prices. My automations are really exceptionally simple now: in the evening, discharge down to a target state of charge to earn income from high feed in prices if I have sufficient state of charge. In the day, delay charging the battery while feed in is worth more (and feed in) if remaining solar is going to top me up (though that last one is currently disabled as I can charge from free every day). |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Yeah, I've got a backstop - if it is within three hours of dawn, and SoC is < 10%, reduce reserve from 5% to 1%. I don't reduce to 0% because if it hits zero, it then consumes about 1kWh to return to 0%, whereas if it hits 1%, it just switches load to the grid, which is likely to use less grid. That automation has fired twice - on very overcast mornings. alias: Reduce Reserve
description: Drain battery if already low and dawn soon.
triggers:
- trigger: numeric_state
entity_id:
- sensor.powerwall_percentage_charged
below: 10
conditions:
- condition: sun
after: sunrise
after_offset: "-3:00:00"
actions:
- device_id: <id of powerwall gateway in telsa fleet>
domain: number
entity_id: <id of backup reserve percentage>
type: set_value
value: 1
mode: single |
Beta Was this translation helpful? Give feedback.
-
If you've got any scenario-based Jinja2 to contribute then we're all ears and would welcome PRs. |
Beta Was this translation helpful? Give feedback.
-
How'd you go, @Noodleyman? |
Beta Was this translation helpful? Give feedback.
-
This has been converted to a discussion. As a FR it will almost certainly never fly given there are simpler alternatives. |
Beta Was this translation helpful? Give feedback.
-
Andddddd, back from a nice holiday! so can revisit this thread :) I am doing almost the same thing as @BJReplay currently, but with some extras. I use PredBat to determine what my battery charge % should be overnight. I use EON Drive which gives me midnight -> 7AM at 6.7p per kWh. I have a 3.68kWh export limit (very rural) with 15.5kWp over 36 panels. I currently have a single battery but have a 2nd on order. thus the content below is for 1 battery. I'm using solar edge, SE8000H inverter. the time my items trigger is dynamic based upon previous events. I have some bespoke helpers in HA.
I also have some bespoke sensors, those are:
The "Override Predbat" toggle allows me to flip a switch, which triggers some automations. I can then use the custom helper in additional status checks within automations. This will enable or disable read only in PredBat
I have a safeguard hard coded to 14:30 to set the system back to the Max Self Consumption Mode, which will prioritize battery charging over export. If the battery isn't full by this time, it will focus on topping it up.
I cross reference the PV forecast "today" to see if the forecated solar amount is > 46kWh. If it is, then I know I can dump my battery to the grid early in the morning to boost export income. This is more useful to me with a 3.68kWh export limit. The time at which the battery dump starts is based upon what happened last time we started this process, and at what time the house needs + max export was met by PV generation. I then start 3 hours earlier than the previously noted time. I add a delay here in case PredBat is in a round of processing, it gets time to wrap up a cycle after read only was enabled. I cross reference the bespoke sensor for my start time. The 3 hours allows for the battery to get down to about 15%, as the PV generation ramps up during that window of time as well. Thus there is always some battery power to make coffee!
Once the PV generation covers max export + house needs, the following automation fires, which sets CLIPPED charging mode and updates the time of day. This mode will take PV generation, cover house needs, then export and whatever can't be export then goes into battery.
If the battery gets full, another automation fires, which will set the mode to max self consuption. aka, use the battery before export. Control is then given back to Predbat as well.
There is an oddity with the above, in that it's almost better to just charge battery to full from midnight in preperation for battery dumping rather than let predbat do it. I liked that PredBat would choose to only charge battery to a lower % sometimes, but this doesn't play nice with the max export model. so to work around this.... another automation based on PV forecast.
Everything above works great... when the PV generation is in the morning... but if it's a slow start to the morning the battery will get emptied and fall back to grid. Thus the request to evaluate the morning PV forecast. However, I've just pulled the trigger on another battery, so when this arrives I will change my setup as in theory I'll not need to use the grid at all for charging until October onwards. an alternate approach would make more sense. |
Beta Was this translation helpful? Give feedback.
-
I also had to add this, so the wife knows when she can go nuts with the high power appliances hah. |
Beta Was this translation helpful? Give feedback.
-
Oh, and I've also setup backup reserves using weather alerts as our power is flakey in most storms. we have the backup module so can run during a power outage. This essentially checks weather alerts, sets the reserve accordingly. I do need to boost this to use the PV forecasts to charge further in advance and hold the charge. currently it'll charge from grid a few hours before the weather warning comes into effect. |
Beta Was this translation helpful? Give feedback.
-
Oh, @Noodleyman I have a half day forecast solution for you: Set up your last x hours sensor to 12 hours (or even, if you want to run this automation at 8pm each night, 16 hours): It won't be as dynamic as everything else, but it sounds like you need it in advance, in any case. So, if you set it to 12 hours, then at around midnight, that sensor will give you the forecast to midday (your morning sensor), and the full day sensor will give you the forecast for the full day. A simple template subtracting the morning sensor from the full day sensor gives you the afternoon sensor. Or pick a time that you know works year-round (in your strange land of sun is still shining at 10pm at night): say 11pm, 13-hour sensor, run your automation at 11pm, and use 13-hour sensor and next day for your two figures. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently using automations to decide if I should charge to full, then discharge my battery based upon the PV forecast. When the Forecast is > 46kWh I have the battery discharge to near empty. This discharge process is dynamic and the time is based upon historical PV genration data. I do this because I have a large PV generation capacity (16kWh), and I want to make use of maxing exports and charging the battery using clipping (feature of the inverter)
In some cases, the overall daily forecast may be 50kWh for example. However, the majority of that generation may come from the last few hours in the afternoon and the morning could possibly be cloudy/raining etc. This means the battery potentialy gets discharged and there is not enough generation in the morning to charge the battery via clipping.
To make a better choice for the automations, it would be really helpful to have a half day forecast. First half and second half. In my use case, I would only be evaluating the first half.
The "day" being the total generation period, from the first time slice with a forecast > 0, to the last non-zero slice. The split between first and last half being the mid-section of that timeframe.
It would be really helpful if additional attributes could be made available to provide the data as above.
Describe alternatives you've considered
Considered attempting a custom sensor to achieve what I would like, however I am unsure on how to do that for the forecast data.
Beta Was this translation helpful? Give feedback.
All reactions