-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Site: add smart feed-in disable (aka zero feed-in) #21839
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @andig - I've reviewed your changes - here's some feedback:
- The new rateAt helper ignores its
t time.Timeparameter and always usestime.Now()—update it to use the passed‐in time for consistency and testability. - The HTTP endpoints for smart-feed-in disabling (e.g.
/smartfeedindisablelimit) use inconsistent casing compared to other routes—standardize on one naming convention for clarity. - There’s a lot of duplicated logic between smart-cost and smart-feed-in handling—consider extracting shared behaviour into a common helper to reduce code duplication.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new rateAt helper ignores its `t time.Time` parameter and always uses `time.Now()`—update it to use the passed‐in time for consistency and testability.
- The HTTP endpoints for smart-feed-in disabling (e.g. `/smartfeedindisablelimit`) use inconsistent casing compared to other routes—standardize on one naming convention for clarity.
- There’s a lot of duplicated logic between smart-cost and smart-feed-in handling—consider extracting shared behaviour into a common helper to reduce code duplication.
## Individual Comments
### Comment 1
<location> `core/site_tariffs.go:177` </location>
<code_context>
+ return site.GetTariff(usage).Type() != api.TariffTypePriceStatic
+}
+
+func rateAt(rates api.Rates, t time.Time) (api.Rate, error) {
+ rate, err := rates.At(time.Now())
+ if len(rates) > 0 && err != nil {
</code_context>
<issue_to_address>
rateAt ignores its time parameter and always uses time.Now()
The function should use the provided `t` parameter in `rates.At` to ensure correct evaluation at the intended time.
</issue_to_address>
### Comment 2
<location> `core/loadpoint/mock.go:925` </location>
<code_context>
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSmartCostLimit", reflect.TypeOf((*MockAPI)(nil).SetSmartCostLimit), limit)
}
+// SetSmartFeedinLimit mocks base method.
+func (m *MockAPI) SetSmartFeedinLimit(limit *float64) {
+ m.ctrl.T.Helper()
</code_context>
<issue_to_address>
Avoid manual edits in a generated mock file
Regenerate the mock with mockgen to include the new methods, rather than editing the file manually.
Suggested implementation:
```golang
```
After removing the manual edit, you must run `mockgen` to regenerate `core/loadpoint/mock.go` with the updated interface that includes `SetSmartFeedinLimit`. This will ensure the mock is up-to-date and correctly generated.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Added the option/limit to the forecast dialog since we dont have a global place for pv-based settings. In a future iteration we should promote forecast (together with other charts) to a top level page and also move battery grid charge there. So one place to see all your forecasted data (production, price, ...) and can make decisions based on this. Future optimizer hints or effects could also live there. |
|
@andig magst du den Konflikt hier auflösen? |
|
Done |
But broken |
|
Should be fixed now. |
|
Added highlighting of affected time slots. See updated screenshots and video in description 👆 |
| vm: shared | ||
| script: | | ||
| 8000; | ||
| feedindisablelimitenable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andig is this the best name? Can we be shorter? feedinDisable, zeroFeedIn, ..?
|
@andig all done from my side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @naltatis, your pull request is too large to review
Why? Forecast wrong? Seems OT here. |
No -2.9c is the actual feedin price for the current 5 minute interval (IE you pay to export), I just use some jq on the feedin forecast to ensure evcc never sees negative prices for the current feedin interval as that mucks up the charging session cost calculations. (car is not earning money by charging because if it wasn't charging the solar would be automatically curtailed and I wouldn't be paying to export - hence being calculated as 0 is correct) Might be better off discussed on #21747 |



Fix #21747, depends on #21813
Also fixes #21832
Disable solar feed-in when feed-in becomes expensive for the user (i.e. network restriction visible due to feed-in tariff). Implemented by restricting the PV inverter to 0W feed-in power.
Requires supported inverter.
💸 add feed-in visualization to forecast modal
👇 proper handling of negative prices (aligned 0-axis)
TODO
/cc @Maschga wenn Du magst könntest Du hier branchen und einen PR für RCT erstellen und testen.
Out of scope
grid.feedin.webm