Added support for Climater
This commit is contained in:
parent
bbb3d940f8
commit
d665e1df70
1 changed files with 17 additions and 1 deletions
|
|
@ -60,7 +60,8 @@ type porscheEmobilityResponse struct {
|
|||
IsActive bool
|
||||
}
|
||||
DirectClimatisation struct {
|
||||
ClimatisationState string
|
||||
ClimatisationState string
|
||||
RemainingClimatisationTime int64
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,3 +363,18 @@ func (v *Porsche) Range() (int64, error) {
|
|||
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Climater implements the api.VehicleClimater interface
|
||||
func (v *Porsche) Climater() (active bool, outsideTemp float64, targetTemp float64, err error) {
|
||||
res, err := v.chargerG()
|
||||
if res, ok := res.(porscheEmobilityResponse); err == nil && ok {
|
||||
switch res.DirectClimatisation.ClimatisationState {
|
||||
case "OFF":
|
||||
return false, 0, 0, nil
|
||||
case "ON":
|
||||
return true, 0, 0, nil
|
||||
}
|
||||
}
|
||||
|
||||
return active, outsideTemp, targetTemp, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue