Skip to content

Commit

Permalink
Vehicle Api: publish additional settings (#16853)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Oct 26, 2024
1 parent ce14d93 commit b7b0587
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions core/site_vehicles.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ type planStruct struct {
}

type vehicleStruct struct {
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
Capacity float64 `json:"capacity,omitempty"`
MinSoc int `json:"minSoc,omitempty"`
LimitSoc int `json:"limitSoc,omitempty"`
Features []string `json:"features,omitempty"`
Plans []planStruct `json:"plans,omitempty"`
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
Capacity float64 `json:"capacity,omitempty"`
Phases int `json:"phases,omitempty"`
MinSoc int `json:"minSoc,omitempty"`
LimitSoc int `json:"limitSoc,omitempty"`
MinCurrent float64 `json:"minCurrent,omitempty"`
MaxCurrent float64 `json:"maxCurrent,omitempty"`
Priority int `json:"priority,omitempty"`
Features []string `json:"features,omitempty"`
Plans []planStruct `json:"plans,omitempty"`
}

// publishVehicles returns a list of vehicle titles
Expand All @@ -41,15 +45,20 @@ func (site *Site) publishVehicles() {
}

instance := v.Instance()
ac := instance.OnIdentified()

res[v.Name()] = vehicleStruct{
Title: instance.Title(),
Icon: instance.Icon(),
Capacity: instance.Capacity(),
MinSoc: v.GetMinSoc(),
LimitSoc: v.GetLimitSoc(),
Features: lo.Map(instance.Features(), func(f api.Feature, _ int) string { return f.String() }),
Plans: plans,
Title: instance.Title(),
Icon: instance.Icon(),
Capacity: instance.Capacity(),
Phases: instance.Phases(),
MinSoc: v.GetMinSoc(),
LimitSoc: v.GetLimitSoc(),
MinCurrent: ac.MinCurrent,
MaxCurrent: ac.MaxCurrent,
Priority: ac.Priority,
Features: lo.Map(instance.Features(), func(f api.Feature, _ int) string { return f.String() }),
Plans: plans,
}

if lp := site.coordinator.Owner(instance); lp != nil {
Expand Down

0 comments on commit b7b0587

Please sign in to comment.