Bluelink: add soc limit (#4452)
This commit is contained in:
parent
d8ac684020
commit
d5ba6797d6
2 changed files with 30 additions and 1 deletions
|
|
@ -168,3 +168,20 @@ func (v *Provider) Odometer() (float64, error) {
|
|||
res, err := v.statusLG()
|
||||
return res.ResMsg.VehicleStatusInfo.Odometer.Value, err
|
||||
}
|
||||
|
||||
var _ api.SocLimiter = (*Provider)(nil)
|
||||
|
||||
// TargetSoC implements the api.SocLimiter interface
|
||||
func (v *Provider) TargetSoC() (float64, error) {
|
||||
res, err := v.statusG()
|
||||
|
||||
if err == nil {
|
||||
for _, targetSOC := range res.EvStatus.ReservChargeInfos.TargetSocList {
|
||||
if targetSOC.PlugType == plugTypeAC {
|
||||
return float64(targetSOC.TargetSocLevel), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ type VehicleStatus struct {
|
|||
Value, Unit int
|
||||
}
|
||||
}
|
||||
DrvDistance []DrivingDistance
|
||||
DrvDistance []DrivingDistance
|
||||
ReservChargeInfos ReservChargeInfo
|
||||
}
|
||||
Vehicles []Vehicle
|
||||
}
|
||||
|
|
@ -58,6 +59,8 @@ type Odometer struct {
|
|||
const (
|
||||
timeFormat = "20060102150405 -0700" // Note: must add timeOffset
|
||||
timeOffset = " +0100"
|
||||
|
||||
plugTypeAC = 1
|
||||
)
|
||||
|
||||
func (d *VehicleStatus) Updated() (time.Time, error) {
|
||||
|
|
@ -71,3 +74,12 @@ type DrivingDistance struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
type ReservChargeInfo struct {
|
||||
TargetSocList []TargetSoc
|
||||
}
|
||||
|
||||
type TargetSoc struct {
|
||||
TargetSocLevel int
|
||||
PlugType int
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue