Bluelink: add climater (#18370)
This commit is contained in:
parent
3bccab48b3
commit
c3e7f59f18
2 changed files with 24 additions and 2 deletions
|
|
@ -147,6 +147,17 @@ func (v *Provider) Odometer() (float64, error) {
|
|||
return res.Odometer()
|
||||
}
|
||||
|
||||
var _ api.VehicleClimater = (*Provider)(nil)
|
||||
|
||||
// Climater implements the api.VehicleClimater interface
|
||||
func (v *Provider) Climater() (bool, error) {
|
||||
res, err := v.statusG()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return res.Climater()
|
||||
}
|
||||
|
||||
var _ api.SocLimiter = (*Provider)(nil)
|
||||
|
||||
// GetLimitSoc implements the api.SocLimiter interface
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ type BluelinkVehicleStatus interface {
|
|||
Status() (api.ChargeStatus, error)
|
||||
FinishTime() (time.Time, error)
|
||||
Range() (int64, error)
|
||||
Climater() (bool, error)
|
||||
GetLimitSoc() (int64, error)
|
||||
}
|
||||
|
||||
|
|
@ -48,8 +49,10 @@ type StatusLatestResponse struct {
|
|||
}
|
||||
|
||||
type VehicleStatus struct {
|
||||
Time string
|
||||
EvStatus *struct {
|
||||
Time string
|
||||
AirCtrlOn bool
|
||||
Defrost bool
|
||||
EvStatus *struct {
|
||||
BatteryCharge bool
|
||||
BatteryStatus float64
|
||||
BatteryPlugin int
|
||||
|
|
@ -150,6 +153,10 @@ func (d VehicleStatus) Range() (int64, error) {
|
|||
return 0, api.ErrNotAvailable
|
||||
}
|
||||
|
||||
func (d VehicleStatus) Climater() (bool, error) {
|
||||
return d.AirCtrlOn || d.Defrost, nil
|
||||
}
|
||||
|
||||
func (d VehicleStatus) GetLimitSoc() (int64, error) {
|
||||
if d.EvStatus != nil {
|
||||
for _, targetSOC := range d.EvStatus.ReservChargeInfos.TargetSocList {
|
||||
|
|
@ -323,6 +330,10 @@ func (d StatusLatestResponseCCS) Range() (int64, error) {
|
|||
return d.ResMsg.State.Vehicle.Drivetrain.FuelSystem.DTE.Total, nil
|
||||
}
|
||||
|
||||
func (d StatusLatestResponseCCS) Climater() (bool, error) {
|
||||
return false, api.ErrNotAvailable
|
||||
}
|
||||
|
||||
func (d StatusLatestResponseCCS) GetLimitSoc() (int64, error) {
|
||||
if d.ResMsg.State.Vehicle.Green != nil {
|
||||
return d.ResMsg.State.Vehicle.Green.ChargingInformation.TargetSoC.Standard, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue