Renault: add E-tech vehicles wakeup mode (BC) (#21432)
This commit is contained in:
parent
8f023cb8df
commit
3fd51d3d26
5 changed files with 53 additions and 11 deletions
|
|
@ -8,10 +8,19 @@ params:
|
|||
- name: alternativewakeup
|
||||
type: bool
|
||||
description:
|
||||
de: Alternativer Aufweckmechanismus
|
||||
en: Alternative wakeup mechanism
|
||||
de: Alternative Aufweckmechanismus (veraltet)
|
||||
en: Alternative wakeup mechanism (deprecated)
|
||||
advanced: true
|
||||
deprecated: true
|
||||
- name: wakeupmode
|
||||
type: choice
|
||||
choice: ["default", "alternative", "MY24"]
|
||||
default: default
|
||||
description:
|
||||
de: Aufweckmechanismus
|
||||
en: Wakeup mechanism
|
||||
advanced: true
|
||||
render: |
|
||||
type: renault
|
||||
{{ include "vehicle-base" . }}
|
||||
alternativewakeup: {{ .alternativewakeup }}
|
||||
wakeupmode: {{ .wakeupmode }}
|
||||
|
|
|
|||
|
|
@ -40,13 +40,14 @@ func NewRenaultDaciaFromConfig(brand string, other map[string]interface{}) (api.
|
|||
cc := struct {
|
||||
embed `mapstructure:",squash"`
|
||||
User, Password, Region, VIN string
|
||||
AlternativeWakeup bool
|
||||
WakeupMode string
|
||||
Cache time.Duration
|
||||
Timeout time.Duration
|
||||
}{
|
||||
Region: "de_DE",
|
||||
Cache: interval,
|
||||
Timeout: request.Timeout,
|
||||
Region: "de_DE",
|
||||
WakeupMode: "default",
|
||||
Cache: interval,
|
||||
Timeout: request.Timeout,
|
||||
}
|
||||
|
||||
if err := util.DecodeOther(other, &cc); err != nil {
|
||||
|
|
@ -94,7 +95,7 @@ func NewRenaultDaciaFromConfig(brand string, other map[string]interface{}) (api.
|
|||
err = vehicle.Available()
|
||||
}
|
||||
|
||||
v.Provider = renault.NewProvider(api, accountID, vehicle.VIN, cc.AlternativeWakeup, cc.Cache)
|
||||
v.Provider = renault.NewProvider(api, accountID, vehicle.VIN, cc.WakeupMode, cc.Cache)
|
||||
|
||||
return v, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,21 @@ func (v *API) WakeUp(accountID string, vin string) (Response, error) {
|
|||
return v.request(uri, request.MarshalJSON(data))
|
||||
}
|
||||
|
||||
func (v *API) WakeUpMY24(accountID string, vin string) (Response, error) {
|
||||
uri := fmt.Sprintf("%s/commerce/v1/accounts/%s/kamereon/kcm/v1/vehicles/%s/ev/settings", v.keys.Target, accountID, vin)
|
||||
|
||||
data := EvSettingsRequest{
|
||||
LastSettingsUpdateTimestamp: "2025-04-24T12:41:41.823Z",
|
||||
DelegatedActivated: false,
|
||||
ChargeModeRq: "SCHEDULED",
|
||||
ChargeTimeStart: "21:00",
|
||||
ChargeDuration: 1615,
|
||||
PreconditioningTemperature: 20.0,
|
||||
}
|
||||
|
||||
return v.request(uri, request.MarshalJSON(data))
|
||||
}
|
||||
|
||||
func (v *API) Position(accountID string, vin string) (Response, error) {
|
||||
uri := fmt.Sprintf("%s/commerce/v1/accounts/%s/kamereon/kca/car-adapter/v1/cars/%s/location", v.keys.Target, accountID, vin)
|
||||
return v.request(uri, nil)
|
||||
|
|
|
|||
|
|
@ -70,3 +70,16 @@ type attributes struct {
|
|||
Latitude float64 `json:"gpsLatitude"`
|
||||
Longitude float64 `json:"gpsLongitude"`
|
||||
}
|
||||
|
||||
type EvSettingsRequest struct {
|
||||
LastSettingsUpdateTimestamp string `json:"lastSettingsUpdateTimestamp"`
|
||||
DelegatedActivated bool `json:"delegatedActivated"`
|
||||
ChargeModeRq string `json:"chargeModeRq"`
|
||||
ChargeTimeStart string `json:"chargeTimeStart"`
|
||||
ChargeDuration int `json:"chargeDuration"`
|
||||
PreconditioningTemperature float64 `json:"preconditioningTemperature"`
|
||||
PreconditioningHeatedStrgWheel bool `json:"preconditioningHeatedStrgWheel"`
|
||||
PreconditioningHeatedRightSeat bool `json:"preconditioningHeatedRightSeat"`
|
||||
PreconditioningHeatedLeftSeat bool `json:"preconditioningHeatedLeftSeat"`
|
||||
Programs []interface{} `json:"programs"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type Provider struct {
|
|||
}
|
||||
|
||||
// NewProvider creates a vehicle api provider
|
||||
func NewProvider(api *kamereon.API, accountID, vin string, alternativeWakeup bool, cache time.Duration) *Provider {
|
||||
func NewProvider(api *kamereon.API, accountID, vin string, wakeupMode string, cache time.Duration) *Provider {
|
||||
impl := &Provider{
|
||||
batteryG: util.Cached(func() (kamereon.Response, error) {
|
||||
return api.Battery(accountID, vin)
|
||||
|
|
@ -36,10 +36,14 @@ func NewProvider(api *kamereon.API, accountID, vin string, alternativeWakeup boo
|
|||
return api.Hvac(accountID, vin)
|
||||
}, cache),
|
||||
wakeup: func() (kamereon.Response, error) {
|
||||
if alternativeWakeup {
|
||||
switch wakeupMode {
|
||||
case "alternative":
|
||||
return api.Action(accountID, kamereon.ActionStart, vin)
|
||||
case "MY24":
|
||||
return api.WakeUpMY24(accountID, vin)
|
||||
default:
|
||||
return api.WakeUp(accountID, vin)
|
||||
}
|
||||
return api.WakeUp(accountID, vin)
|
||||
},
|
||||
position: func() (kamereon.Response, error) {
|
||||
return api.Position(accountID, vin)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue