Enyaq: add settings api (#3773)

This commit is contained in:
Elina Urbanovich 2022-07-07 18:54:36 +03:00 • committed by GitHub
parent a0d75bb828
commit 490e0edd4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -55,6 +55,14 @@ func (v *API) Charger(vin string) (ChargerResponse, error) {
return res, err
}
// Settings implements the /v1/charging/<vin>/settings response
func (v *API) Settings(vin string) (SettingsResponse, error) {
var res SettingsResponse
uri := fmt.Sprintf("%s/v1/charging/%s/settings", BaseURI, vin)
err := v.GetJSON(uri, &res)
return res, err
}
const (
ActionCharge = "charging"
ActionChargeStart = "Start"

View file

@ -35,3 +35,10 @@ type ChargerResponse struct {
StateOfChargeInPercent int
}
}
// SettingsResponse is the /v1/charging/<vin>/settings api
type SettingsResponse struct {
AutoUnlockPlugWhenCharged string `json:"autoUnlockPlugWhenCharged"`
MaxChargeCurrentAc string `json:"maxChargeCurrentAc"`
TargetStateOfChargeInPercent int `json:"targetStateOfChargeInPercent"`
}