Skip to content

Commit

Permalink
Renault: add alternative wakeup (#11537)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Jan 10, 2024
1 parent 00b2a32 commit da966f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions templates/definition/vehicle/renault.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
3 changes: 2 additions & 1 deletion vehicle/renault.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}{
Expand Down Expand Up @@ -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
}
5 changes: 4 additions & 1 deletion vehicle/renault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand Down

0 comments on commit da966f5

Please sign in to comment.