Tronity: fix api response types

This commit is contained in:
andig 2021-08-05 15:10:31 +02:00
parent bb910a5cd5
commit 8075cfc222
2 changed files with 20 additions and 12 deletions

View file

@ -165,7 +165,7 @@ func (v *Tronity) SoC() (float64, error) {
res, err := v.bulkG()
if res, ok := res.(tronity.Bulk); err == nil && ok {
return float64(res.Level), nil
return res.Level, nil
}
return 0, err

View file

@ -1,5 +1,7 @@
package tronity
// https://app.platform.tronity.io/docs#operation
type Vehicles struct {
Data []Vehicle
}
@ -12,24 +14,24 @@ type Vehicle struct {
}
type Bulk struct {
VIN string
Odometer int
Range int
Level int
Charging string // Charging
Latitude float64
Longitude float64
VIN string
Odometer float64
Range float64
Level float64
Charging string // Charging
// Latitude float64/string
// Longitude float64/string
Timestamp int64
}
type Odometer struct {
Odometer int
Timestamp int64
Odometer float64
Timestamp float64
}
type EVBatteryLevel struct {
Range int
Level int
Range float64
Level float64
Timestamp int64
}
@ -37,3 +39,9 @@ type EVChargingStatus struct {
Charging string
Timestamp int64
}
type Location struct {
// Latitude float64/string
// Longitude float64/string
Timestamp int64
}