Mercedes: add limit soc (#15006)

This commit is contained in:
Rene Nulsch 2024-07-23 19:05:20 +02:00 • committed by GitHub
parent e94cc98058
commit a3ad69c442
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 3 deletions

View file

@ -97,5 +97,15 @@ func (v *API) Status(vin string) (StatusResponse, error) {
res.EvInfo.Battery.ChargingStatus = 3
}
if val, ok := message.Attributes["selectedChargeProgram"]; ok {
res.EvInfo.Battery.SelectedChargeProgram = int(val.GetIntValue())
val := message.Attributes["chargePrograms"].GetChargeProgramsValue()
res.EvInfo.Battery.SocLimit = int(val.ChargeProgramParameters[res.EvInfo.Battery.SelectedChargeProgram].GetMaxSoc())
} else {
if val, ok := message.Attributes["maxSoc"]; ok {
res.EvInfo.Battery.SocLimit = int(val.GetIntValue())
}
}
return res, err
}

View file

@ -42,6 +42,14 @@ func (v *Provider) Odometer() (float64, error) {
return float64(res.VehicleInfo.Odometer.Value), err
}
var _ api.SocLimiter = (*Provider)(nil)
// GetLimitSoc implements the api.SocLimiter interface
func (v *Provider) GetLimitSoc() (int64, error) {
res, err := v.dataG()
return int64(res.EvInfo.Battery.SocLimit), err
}
var _ api.ChargeState = (*Provider)(nil)
// Status implements the api.ChargeState interface

View file

@ -60,9 +60,11 @@ type StatusResponse struct {
Value int
Unit string
}
StateOfCharge float64 // 75
EndOfChargeTime int // Minutes after midnight
TotalRange int // 17
StateOfCharge float64 // 75
EndOfChargeTime int // Minutes after midnight
TotalRange int // 17
SocLimit int // 50-100
SelectedChargeProgram int
}
Timestamp time.Time
}