Skip to content

Commit

Permalink
chore: use loadpoint Title() instead of Name()
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Feb 3, 2023
1 parent 80acb35 commit ea381b2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
7 changes: 1 addition & 6 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type Loadpoint struct {
sync.Mutex // guard status
Mode api.ChargeMode `mapstructure:"mode"` // Charge mode, guarded by mutex

Title string `mapstructure:"title"` // UI title
Title_ string `mapstructure:"title"` // UI title
ConfiguredPhases int `mapstructure:"phases"` // Charger configured phase mode 0/1/3
ChargerRef string `mapstructure:"charger"` // Charger reference
VehicleRef string `mapstructure:"vehicle"` // Vehicle reference
Expand Down Expand Up @@ -540,11 +540,6 @@ func (lp *Loadpoint) applyAction(actionCfg api.ActionConfig) {
}
}

// Name returns the human-readable loadpoint title
func (lp *Loadpoint) Name() string {
return lp.Title
}

// Prepare loadpoint configuration by adding missing helper elements
func (lp *Loadpoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Event, lpChan chan<- *Loadpoint) {
lp.uiChan = uiChan
Expand Down
4 changes: 2 additions & 2 deletions core/loadpoint/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type Controller interface {

// API is the external loadpoint API
type API interface {
// Name returns the defined loadpoint name
Name() string
// Title returns the defined loadpoint title
Title() string

//
// status
Expand Down
5 changes: 5 additions & 0 deletions core/loadpoint_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (

var _ loadpoint.API = (*Loadpoint)(nil)

// Title returns the human-readable loadpoint title
func (lp *Loadpoint) Title() string {
return lp.Title_
}

// GetStatus returns the charging status
func (lp *Loadpoint) GetStatus() api.ChargeStatus {
lp.Lock()
Expand Down
2 changes: 1 addition & 1 deletion core/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func NewSiteFromConfig(

if serverdb.Instance != nil {
var err error
if lp.db, err = db.New(lp.Title); err != nil {
if lp.db, err = db.New(lp.Title()); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion hems/semp/semp.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (s *SEMP) deviceInfo(id int, lp loadpoint.API) DeviceInfo {
res := DeviceInfo{
Identification: Identification{
DeviceID: s.deviceID(id),
DeviceName: lp.Name(),
DeviceName: lp.Title(),
DeviceType: sempCharger,
DeviceSerial: s.serialNumber(id),
DeviceVendor: "github.com/evcc-io/evcc",
Expand Down
2 changes: 1 addition & 1 deletion server/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (m *Influx) Run(loadPoints []loadpoint.API, in <-chan util.Param) {

tags := make(map[string]string)
if param.Loadpoint != nil {
tags["loadpoint"] = loadPoints[*param.Loadpoint].Name()
tags["loadpoint"] = loadPoints[*param.Loadpoint].Title()
tags["vehicle"] = vehicles[*param.Loadpoint]
}

Expand Down

0 comments on commit ea381b2

Please sign in to comment.