Wakeup: wake via charger and vehicle api in parallel, add for Porsche (#8204)
This commit is contained in:
parent
cedd4f5568
commit
ee16e3bb67
2 changed files with 17 additions and 1 deletions
|
|
@ -179,7 +179,6 @@ func (lp *Loadpoint) wakeUpVehicle() {
|
|||
if err := c.WakeUp(); err != nil {
|
||||
lp.log.ERROR.Printf("wake-up charger: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// vehicle
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ type Provider struct {
|
|||
statusG func() (StatusResponse, error)
|
||||
emobilityG func() (EmobilityResponse, error)
|
||||
mobileG func() (StatusResponseMobile, error)
|
||||
wakeup func() error
|
||||
}
|
||||
|
||||
// NewProvider creates a vehicle api provider
|
||||
|
|
@ -33,6 +34,15 @@ func NewProvider(log *util.Logger, api *API, emobility *EmobilityAPI, mobile *Mo
|
|||
mobileG: provider.Cached(func() (StatusResponseMobile, error) {
|
||||
return mobile.Status(vin, []string{BATTERY_LEVEL, BATTERY_CHARGING_STATE, CLIMATIZER_STATE, E_RANGE, HEATING_STATE, MILEAGE})
|
||||
}, cache),
|
||||
|
||||
wakeup: func() error {
|
||||
_, _ = api.Status(vin)
|
||||
if carModel != "" {
|
||||
_, _ = emobility.Status(vin, carModel)
|
||||
}
|
||||
_, _ = mobile.Status(vin, []string{BATTERY_LEVEL})
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return impl
|
||||
|
|
@ -242,3 +252,10 @@ func (v *Provider) Odometer() (float64, error) {
|
|||
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var _ api.Resurrector = (*Provider)(nil)
|
||||
|
||||
// WakeUp implements the api.Resurrector interface
|
||||
func (v *Provider) WakeUp() error {
|
||||
return v.wakeup()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue