-
-
Notifications
You must be signed in to change notification settings - Fork 946
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.Time
parameter 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.
@naltatis kannst du mit dem Merge helfen? |
UI pack ich nicht… |
@andig resolve the conflict - mostly. I've left one for you :D |
yes, for me it's an pv feature. Requirements for showing it in the ui: dynamic tariff + controllable pv inverter |
@naltatis back over to you? |
Fix #21747, depends on #21813
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.
TODO
/cc @Maschga wenn Du magst könntest Du hier branchen und einen PR für RCT erstellen und testen.