Renault: add alternative wakeup (#11537)
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Demo (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

This commit is contained in:
andig 2024-01-10 21:55:23 +01:00 • committed by GitHub
parent 00b2a327d6
commit da966f5d84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -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 }}

View file

@ -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
}

View file

@ -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) {