Mercedes: add limit soc (#15006)
This commit is contained in:
parent
e94cc98058
commit
a3ad69c442
3 changed files with 23 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue