Renault: add alternative wakeup (#11537)
Some checks failed
Some checks failed
This commit is contained in:
parent
00b2a327d6
commit
da966f5d84
3 changed files with 13 additions and 2 deletions
|
|
@ -6,7 +6,14 @@ params:
|
|||
- preset: vehicle-identify
|
||||
- name: vin
|
||||
example: WREN...
|
||||
- name: alternativewakeup
|
||||
type: bool
|
||||
description:
|
||||
de: Alternativer Aufweckmechanismus
|
||||
en: Alternative wakeup mechanism
|
||||
advanced: true
|
||||
render: |
|
||||
type: renault
|
||||
{{ include "vehicle-base" . }}
|
||||
{{ include "vehicle-identify" . }}
|
||||
alternativewakeup: {{ .alternativewakeup }}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ func NewRenaultDaciaFromConfig(brand string, other map[string]interface{}) (api.
|
|||
cc := struct {
|
||||
embed `mapstructure:",squash"`
|
||||
User, Password, Region, VIN string
|
||||
AlternativeWakeup bool
|
||||
Cache time.Duration
|
||||
Timeout time.Duration
|
||||
}{
|
||||
|
|
@ -93,7 +94,7 @@ func NewRenaultDaciaFromConfig(brand string, other map[string]interface{}) (api.
|
|||
err = vehicle.Available()
|
||||
}
|
||||
|
||||
v.Provider = renault.NewProvider(api, accountID, vehicle.VIN, cc.Cache)
|
||||
v.Provider = renault.NewProvider(api, accountID, vehicle.VIN, cc.AlternativeWakeup, cc.Cache)
|
||||
|
||||
return v, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type Provider struct {
|
|||
}
|
||||
|
||||
// NewProvider creates a vehicle api provider
|
||||
func NewProvider(api *kamereon.API, accountID, vin string, cache time.Duration) *Provider {
|
||||
func NewProvider(api *kamereon.API, accountID, vin string, alternativeWakeup bool, cache time.Duration) *Provider {
|
||||
impl := &Provider{
|
||||
batteryG: provider.Cached(func() (kamereon.Response, error) {
|
||||
return api.Battery(accountID, vin)
|
||||
|
|
@ -35,6 +35,9 @@ func NewProvider(api *kamereon.API, accountID, vin string, cache time.Duration)
|
|||
return api.Hvac(accountID, vin)
|
||||
}, cache),
|
||||
wakeup: func() (kamereon.Response, error) {
|
||||
if alternativeWakeup {
|
||||
return api.Action(accountID, kamereon.ActionStart, vin)
|
||||
}
|
||||
return api.WakeUp(accountID, vin)
|
||||
},
|
||||
position: func() (kamereon.Response, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue