Add smart feed-in priority (#21813)

This commit is contained in:
andig 2025-06-27 09:03:46 +02:00 • committed by GitHub
parent 6ba804b106
commit 42ed7da2e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1645 additions and 1290 deletions

View file

@ -167,10 +167,14 @@ type API interface {
// smart grid charging
//
// GetSmartChargingActive determines if smart charging is active
// GetSmartCostLimit return the smart cost limit
GetSmartCostLimit() *float64
// SetSmartCostLimit sets the smart cost limit
SetSmartCostLimit(limit *float64)
// GetSmartFeedInPriorityLimit return the smart feed-in limit
GetSmartFeedInPriorityLimit() *float64
// SetSmartFeedInPriorityLimit sets the smart feed-in limit
SetSmartFeedInPriorityLimit(limit *float64)
//
// power and energy

View file

@ -17,18 +17,19 @@ type StaticConfig struct {
type DynamicConfig struct {
// dynamic config
Title string `json:"title"`
DefaultMode string `json:"defaultMode"`
Priority int `json:"priority"`
PhasesConfigured int `json:"phasesConfigured"`
MinCurrent float64 `json:"minCurrent"`
MaxCurrent float64 `json:"maxCurrent"`
SmartCostLimit *float64 `json:"smartCostLimit"`
PlanEnergy float64 `json:"planEnergy"`
PlanTime time.Time `json:"planTime"`
PlanPrecondition int64 `json:"planPrecondition"`
LimitEnergy float64 `json:"limitEnergy"`
LimitSoc int `json:"limitSoc"`
Title string `json:"title"`
DefaultMode string `json:"defaultMode"`
Priority int `json:"priority"`
PhasesConfigured int `json:"phasesConfigured"`
MinCurrent float64 `json:"minCurrent"`
MaxCurrent float64 `json:"maxCurrent"`
SmartCostLimit *float64 `json:"smartCostLimit"`
SmartFeedInPriorityLimit *float64 `json:"smartFeedInPriorityLimit"`
PlanEnergy float64 `json:"planEnergy"`
PlanTime time.Time `json:"planTime"`
PlanPrecondition int64 `json:"planPrecondition"`
LimitEnergy float64 `json:"limitEnergy"`
LimitSoc int `json:"limitSoc"`
Thresholds ThresholdsConfig `json:"thresholds"`
Soc SocConfig `json:"soc"`
@ -56,6 +57,7 @@ func (payload DynamicConfig) Apply(lp API) error {
lp.SetTitle(payload.Title)
lp.SetPriority(payload.Priority)
lp.SetSmartCostLimit(payload.SmartCostLimit)
lp.SetSmartFeedInPriorityLimit(payload.SmartFeedInPriorityLimit)
lp.SetThresholds(payload.Thresholds)
lp.SetPlanEnergy(payload.PlanTime, time.Duration(payload.PlanPrecondition)*time.Second, payload.PlanEnergy)
lp.SetLimitEnergy(payload.LimitEnergy)

View file

@ -548,6 +548,20 @@ func (mr *MockAPIMockRecorder) GetSmartCostLimit() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSmartCostLimit", reflect.TypeOf((*MockAPI)(nil).GetSmartCostLimit))
}
// GetSmartFeedInPriorityLimit mocks base method.
func (m *MockAPI) GetSmartFeedInPriorityLimit() *float64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetSmartFeedInPriorityLimit")
ret0, _ := ret[0].(*float64)
return ret0
}
// GetSmartFeedInPriorityLimit indicates an expected call of GetSmartFeedInPriorityLimit.
func (mr *MockAPIMockRecorder) GetSmartFeedInPriorityLimit() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSmartFeedInPriorityLimit", reflect.TypeOf((*MockAPI)(nil).GetSmartFeedInPriorityLimit))
}
// GetSocConfig mocks base method.
func (m *MockAPI) GetSocConfig() SocConfig {
m.ctrl.T.Helper()
@ -908,6 +922,18 @@ func (mr *MockAPIMockRecorder) SetSmartCostLimit(limit any) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSmartCostLimit", reflect.TypeOf((*MockAPI)(nil).SetSmartCostLimit), limit)
}
// SetSmartFeedInPriorityLimit mocks base method.
func (m *MockAPI) SetSmartFeedInPriorityLimit(limit *float64) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetSmartFeedInPriorityLimit", limit)
}
// SetSmartFeedInPriorityLimit indicates an expected call of SetSmartFeedInPriorityLimit.
func (mr *MockAPIMockRecorder) SetSmartFeedInPriorityLimit(limit any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSmartFeedInPriorityLimit", reflect.TypeOf((*MockAPI)(nil).SetSmartFeedInPriorityLimit), limit)
}
// SetSocConfig mocks base method.
func (m *MockAPI) SetSocConfig(soc SocConfig) {
m.ctrl.T.Helper()